Guest post by Sebastian Barthelmess, Senior Enterprise Developer.
Who wants invocation?
Trust me, you do. Inter-app communication has always been a challenge for developers, and will continue to be one as the mobile landscape continues to expand. Users have an unwritten expectation that their apps should seamlessly work together…even in the enterprise. Unfortunately, not having control over other applications is the primary roadblock when it comes to communication between your app and another. BlackBerry 10 answered this call with our Invocation Framework on the initial release of BB10 OS, and has been refining it since.
Our online docs are great explaining how to use invocation in your app.We have a number of core apps that are invokable through the Invocation framework – to both Native and Hybrid apps.
What does Invocation truly mean?
If you were as impressed by our awesome invocation framework on BlackBerry 10 as I was, wait until you see what else you can do with it! First, the ability to launch any other app from your app is a powerful developer tool; it allows you to simplify your app by using the native viewers transparently. Because, after all, there’s no sense recreating the wheel! All of the maintenance, bug fixing and development can be maintained by the invokee and allow you to focus on what your app does best.
I’m sold, how does URI make it better?
The most popular Uniform Resource Identifiers (URIs) are http:, https: and file:. You can create a URI that will launch your app right now on BB10, and you can hand it a payload just like a URL in your browser. Not convinced that this is groundbreaking yet? Let’s look at a few scenarios:
- You want to have your users run this great new app that you just pushed to them over the BES, but no one has heard of it yet, or even knows it’s there.
- Sending a follow-up email with an embedded link, “myApp://” that they can click on and launch the app.
- You want to launch your app from a notification in the HUB.
- Send the link in your notification (for an example, the ECL application does this).
- You got a support call and you need the user to launch the app with some debug flags.
- Text or BBM them a link to “myApp:?mode=debug&data=my%20test%20data”. One click and they are on their way.
- You want your app to be invokable by an already existing app.
- They can just call your app by URI instead of recompiling invocation capabilities into their app. Simple, fast and extensible.
How do I invoke with a URI?
It’s incredibly simple:
- Register your URI:
- If it’s a WebWorks app, update your config.xml. It looks like this (from the ECL app):
<!-- This will cause the application to be opened -->
- If it’s a Cascades/Native app, update your bar-descriptor.xml. Here is the example from the Cascades Webview app:
<!-- Allow myself to be invoked by uri "webview://" -->
- Install your app.
- It is instantly available as an invocation target for other apps on your device.
- Test it in a browser URL! Nothin’ to it but to do it!
HTML5 / Hybrid
The new ECL application makes use of invocation to launch from the HUB:
And some eye-candy:
The Cascades WebView example is an excellent example of passing data with the URI to search TMDB for a movie title.
Here is the screenflow from a browser URL in BlackBerry 10:
Lastly, if you have any problems, reach out to your BlackBerry account manager for assistance. You are also welcome to tweet me @latestlinux, or post a comment below with any questions or suggestions.