A couple weeks back, my friend Paul Bernhardt posted a sample that showed how to integrate your Cascades app into Extended Search. This a cool thing that I imagine many apps could be using – and it’s especially valuable on the Q10/Q5 devices with Instant Action. Of course the immediate question is: Does this work with WebWorks? And it sure does! Extended Search just leverages the Invocation Framework, so it’s super easy to integrate. Honestly, it takes longer for the HTML5 team to decide on a place for lunch than it took me to add this feature into an app.
Getting included in the Search framework is as simple as including an invocation target, so the system knows your app should be listed. The key parts here that make your app appear are the action and the mime-type. Since you’re going to be responding to an invocation, you’ll need to invocation features as well. Put this in your config.xml and edit the target id to be unique for your application:
<feature id=”blackberry.invoked” version=”1.0.0″ required=”true” />
<feature id=”blackberry.invoke” version=”1.0.0″ required=”true” />
After that, you need to listen for that invocation event in your application. It’s essentially the same code for any type of invocation that you respond to, so check the action value to see what type of invocation it is and then use the data value to determine what the user is searching for:
blackberry.event.addEventListener(“invoked”, function (invocationInfo)
if (invocationInfo.action && invocationInfo.action == ‘bb.action.SEARCH.EXTENDED’)
toast(‘Searching for…’ + atob(invocationInfo.data));
// Send this value to your App’s search function: atob(invocationInfo.data)
And that’s it. Run the search app and type something to search for, and your app icon will appear in the list as a target to do an extended search. As Paul said, if your app has a search function in it, it should be in this list, and now you know how easy it is.