DEVELOPERS BLOG

BlackBerry Dynamics Launcher Framework and BlackBerry Branding

 

The Launcher is a unique feature available to BlackBerry Dynamics applications. With the Launcher Pad shown above within BlackBerry Work, the user can access different features such as email, calendar, contacts, and documents. Additionally, other apps can be launched such as the administrator-defined app store and other BlackBerry Dynamics applications in this case the BlackBerry UEM Client, BlackBerry Docs To Go and Polaris Office for BlackBerry from Infraware. Since nearly everything you need to get your work done is accessible, the Launcher has been called the mobile desktop and is increasingly requested by customers in the apps they frequently use.

The round Launcher Button is in the lower right hand corner of the screen above. It appears in your app when the Launcher Pad is not displayed and can be dragged to any location on the screen. Pressing it displays the Launcher Pad as shown above.

This blog describes how to programmatically enable your own BlackBerry Dynamics applications to display the Launcher for basic use. Please consult the Developer Guide: BlackBerry Launcher Framework for Android and iOS document for more detail and IT administrator setup required for advanced features. This document is available through the BlackBerry Developers Network on the download pages for the iOS and Android versions of the Launcher Framework.

The BlackBerry Launcher Framework is installed with the BlackBerry Dynamics SDK library. They are mutually dependent so you must use corresponding versions of the two libraries. The Launcher Framework distributions come with a sample RSS Reader application that you can examine to see how the BlackBerry Dynamics Launcher Framework is implemented.

The Launcher and Branding

Note the BlackBerry branding on the Launcher button. Recent versions of the SDK and the Launcher Framework have transitioned to the BlackBerry branding from the original Good Technology branding. BlackBerry strongly recommends that you use a recent SDK and Launcher Framework that include this branding. In any case, you should be using a recent SDK and Launcher to be up to date with new features and bug fixes.

Integrating the Launcher Framework on iOS

The Launcher Framework can be integrated into your Xcode project like any other library.

Adding to Your Xcode Project 

Adding the Launcher Framework to your Xcode project is the same as any other library with a few differences. See the document mentioned above for directions.

Starting

After the GDiOS delegate receives the onAuthorized: callback, the Launcher Framework needs to start up various services that call into the BlackBerry Dynamics API. Starting the Launcher requires that startup options be provided. The default and most commonly used call is startServicesWithOptions as used below in code extracted from the sample’s AppDelegate.m. See the Developer Guide for other options. The only code added for the Launcher are the 3 lines containing the launchPadVC under the comment – //Setup the root view controller.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-(void) onAuthorized:(GDAppEvent*)anEvent
(
/* Handle the Good Libraries authorized event. */
switch (anEvent.code) {
case GDErrorNone: {
if (!started) {
// launch application UI here
started = YES;
 
//Detect the device
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
(
/*
* iPhone start - based on single UINavigationController
*/
 
//Setup the root view controller
RootViewController *rootViewController = [[RootViewController alloc]
initWithNibName:@"RootViewController_iPhone" bundle:nil];
 
//Start up the root navigation controller with the root view controller
_navController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
GTLauncherViewController *launchPadVC = [[GTLauncherViewController alloc] initWithBaseViewController:_navController];
[self.window setRootViewController:launchPadVC];
[launchPadVC startServicesWithOptions:GTLInternalGDAuthTokenAndPushConnectionManagement];
}
else

 

Integrating the Launcher Framework on Android

The Launcher Framework can be integrated into any Android library project.

Setup in Gradle and Android Studio for the sample or another app

Steps to setup for Gradle and Android Studio are given in the Developer Guide. Also, instructions for configuring the sample app and another existing app are given in the document.

Initialization, registration and program setup

1. Initialize the Launcher Framework

LauncherButton.initForApplication(Application context, Collection<Class> activities, ActivitiesTargetingMethod method);

Where

context is a context of the application where the Launcher Framework is integrated.

activities is a list of application activities where the Launcher Button should be excluded or should be included according to the 3rd argument.

method is either LauncherButton.ActivitiesTargetingMethod.Exclusive

or LauncherButton.ActivitiesTargetingMethod.Inclusive

2. The BlackBerry Dynamics application notifies the Launcher of authorization state change with the method: HostingApp.getInstance().setAuthorized.

  • Set to true when BlackBerry Dynamics state EventListener notifies

onAuthorized state

  • Set to false when EventListener notifies onLocked state

3. Register GDServiceClientListener if needed

The Launcher Framework uses GDServiceClient to start applications listed on the Launcher pad.
The GDServiceClient requires an instance of GDServiceClientListener but only one listener can be set. In case your application already defines GDServiceClientListener, it should be passed to the Launcher Framework. Otherwise, the Framework’s default GDServiceClientListener is set to GDServiceClient and the application’s GDServiceClientListener is reset.

4. Handle the Launcher Settings button

This button on the Launcher Pad is intended to invoke your application settings screen. Your application must implement and then register the LauncherCommandCallback interface.

HostingApp.getInstance().setOnCommandCallback(LauncherCommandCallback commandCallback)

 public interface HostingApp.LauncherCommandCallback {

public void onSettingsCommand();

}

Note: see the comment regarding the Proguard configuration in the Developer Guide document.

Moving to Production         

Please see the Developer Guide for details.

From the above you can see that integrating the Launcher into your code either on iOS or Android is quite straightforward. As mentioned, customers are increasingly requesting that the Launcher be added to the apps they frequently use. In anticipation of this request and to make your apps more appealing, BlackBerry recommends you include the Launcher.

 

Richard Schaefer

About Richard Schaefer

Richard is an SME for BlackBerry Dynamics and its ISV ecosystem on the Enterprise Solutions team where he on boards ISVs and certifies their applications for the BlackBerry Marketplace.