Building bridges for Enterprise Mobility

Open Source

 

dennis1

 

App URL – A cross-platform love story

Invocation

BlackBerry has a great invocation framework allowing you to easily interact with Applications on BlackBerry 10, reuse code from other applications and exchange information between applications.

But when trying to use invocation cross-platform (iOS, Android, BB10) , it’s a separate implementation for each and every type of Platform.

Cross-Platform invocation

There is a way to be able to talk cross-platform with invocation that even works on the web. Connecting for instance emails, web content and other applications with your application.

The way to do this is using the App URL method.

You can construct a URL matching pattern, which will allow your application to be invoked when called with a URL scheme. This can be both a Web URL scheme: http:// or an application specific URL scheme: <myapp>://

App URL’s are widely supported by the industry and a good starting point to learn more about the is at: http://appurl.org/ . There is already a wide support from the Applications themselves. Just take a look at http://appurl.org/apps/  Once you have implemented App URL’s in your own app you can add yours to the list.

BlackBerry 10 Implementation

To implement an App URL in BlackBerry, you just need to register an invocation target that specifies the wanted URL scheme. In the bar-descriptot.xml add a new target by just adding the following lines.

d01code

Where {element id} is normally your unique reverse dns invocation point, e.g. com.bbsamples.myapp.invocation-1

The {app name} the name of you application as it will be displayed in any dialogs.

The {icon} the location of the image file that will be displayed in any dialogs.

To have this invocation target respond to specific URL schemes, you’ll need to add and implement an invocation filter to the Invocation target:

d02code

The magic is in de <property var=”uris” value=”{scheme}:”></property> part. To register your own App URL just replace the {scheme} part with your desired unique App URL scheme e.g. {scheme} = myapp:

After having created the invocation target, you’ll need to handle the invocation. In your Application add the code to handle the invocations e.g.:

dcode03

 

dc9

dc5

You don’t have to use an URL to invoke this invocation target , you can also still call this target by just making an unbound invocation request from any applications:

Example code

InvokeManager invokeMgr;

InvokeRequest req;

 

req.setUri(QUrl(“myapp:/xyzzy006”));

InvokeTargetReply *reply = invokeMgr.invoke(req);

 

For more reference information and other application platforms, check the AppURL.org website: http://appurl.org/docs/ and BB10 specific: http://appurl.org/docs/bb10

 

Practical Use example – Configuring Applications

One very practical example to use App URLs is to use it to configure applications after they have been deployed to the device. There are quite a number of applications that need to be configured to be able to be used. In many cases this is to ensure the Application points to the right internal systems to get its data from.

As these applications might be on multiple Platforms (iOS, Android, BlackBerry), it’s hard to come to a single method to distribute these configuration details.

This is where an App URL can help. By emailing the users of the applications an email with an App URL that actually contains the configuration for the application, that is the same on all platforms.

dc6

And in our code we handle the request with the following code, where we process the query string of the URL to extract the actual configuration details.

dc7

The end result of this code is when you send a user the following App URL for instance in an email and set it to a clickable link: configdemo://configuration?host=www.blackberry.com&port=443&https=yes&email=sample@blackberry.com&password=12345678

E.g.

“To configure your Business App click HERE

The App would then be launched and show the following information:

dennis2

We’ve used clear text in the query string for demo purposes. But the recommendation is to encrypt the actual payload that only the Application could decrypt to not allow malware to send wrong configuration information.

The Demo code can be found on GitHub here

https://github.com/blackberry/Cascades-Community-Samples/tree/master/app-url

About Dennis Reumer

Principal Consulatant @Strictbv - Helping Organisations in Enterprise Mobility, Strategic, Roadmap and Implementation (Agile, DevOps, EMM) Twitter @reumerd

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus