DEVELOPERS BLOG

Launch Your Apps with Keyboard Shortcuts

CASCADES / 12.01.14 / shadidhaque

With the launch of Blackberry Passport and soon to be launched BlackBerry Classic, one thing is clear; (physical) keyboards are not dead, far from it. For power and productive users like me (nice plug, eh?), I cannot imagine five minutes of my day without keyboard shortcuts. So without further ado, let me introduce one subtle, innovative and mighty feature of BlackBerry OS 10.3.1 – keyboard launch shortcuts for your apps.

The first of the two ways a user can launch your app using keyboard shortcuts is by assigning a key for your app as an App Launch Shortcut. This, by the way, comes for free as in you don’t have to do a thing in your app for this.

Keyboard

While just being able to launch an app may make some users productive, it doesn’t quite satisfy me. What would be truly productive is if I could shortcut to a specific task in an app. If you compare launching the BlackBerry Hub vs launching the composer screen of BlackBerry Hub, you definitely know what I mean. Fortunately, we have also built that in to 10.3.1 for you. But this requires a few lines in your bar-descriptor.

<invoke-target id="com.example.EmergencyResponder">        <invoke-target-type>application</invoke-target-type>        <invoke-target-name>Quick Respond</invoke-target-name>        <icon>               <image>quick_respond_icon.png</image>        </icon>        <filter>               <action>bb.action.SHORTCUT</action>               <mime-type>application/vnd.blackberry.shortcut</mime-type>        </filter> </invoke-target>

Defining an invoke filter with bb.action.SHORTCUT action and application/vnd.blackberry.shortcut as the MIME type, your custom shortcut becomes available for the user to pick from the Other Shortcut category. However, please note that you MUST give the target a meaningful icon and a name for the task it performs as shown in the example above.

Launch 2

You can define as many such shortcut candidates as you wish in your app – each performing a specific task. But wait, it gets better. For some shortcut tasks such as muting device notifications, invoking a UI app does not make any sense. With that in mind, we also enabled the capability to launch headless invoke targets in your apps. So feel free to create such headless shortcut targets but please make sure that you provide the user some feedback after the headless app is done with the task. Otherwise, as a user, I would find it pretty annoying and will have no idea if the task was successful or not. Even flashing the LED or vibrating the device can go a long way but depending on your use case, think about other options such as notification dialogs or instant previews.

BlackBerry users have always been and will always be pushing the boundaries of productivity. I think adding shortcuts to your app is one way of respecting your users as a developer. That’s all folks. Hope this was an awesome read. You now know which apps I am going to purchase for my BlackBerry Classic come 10.3.1. Just let me know when you got one @shadidhaque.

About shadidhaque