Does your app have a search feature? Then you should integrate with the Search app. It’s that simple.  It’s very easy, and makes your app more visible to the user (especially with the addition of Instant Action on the Q10).



First, make your app an Invocation target by adding something like this to your bar-descriptor.xml file:

You specify the invoke-target id property, but everything else there is just a copy/paste.

Next, you need to do a bit of actual work and handle the invocation in code. When your application starts up, you want to register for the invoked signal of InvokeManager:

If it makes sense for you, you can also do something different at startup when the app is invoked, like load a completely different QML file.

Your onInvoked() slot is where the real magic happens though. You get this signal when your app is invoked, whether it was just launched or already running. The InvokeRequest object you get has the action used to invoke your app (for search it’s bb.action.SEARCH.EXTENDED), as well as the search string in the data attribute. All you need to do is take that string and use it to initiate a search in your app. I’d recommend doing something like the following and setting a property in your root AbsbtractPane:

Then, in your QML file just create the property and make changing it do a search, either through the on<propertyName>Changed signal, or using property binding:

This is a simple example, but it’s a simple thing to do. Get the full source here. If you have any questions or comments, send them my way on Twitter: @PBernhardt


Source – 

Discovering Search on BlackBerry 10