The BlackBerry Dynamics runtime monitors the application user interface in order to enforce a number of enterprise security policies. For example, there may be a policy that the user must always enter their security password when the application makes the transition from background to foreground. There may also be a policy that the user interface must be locked after a period of inactivity.
The application user interface must observe a number of restrictions in order to enable monitoring by the runtime. The application code mustn't depend on having control of the user interface at all times.
Every application has a launcher activity. The launcher activity will have the android.intent.category.LAUNCHER
category and the android.intent.action.MAIN
action in the application's AndroidManifest.xml
file. The launcher activity of a BlackBerry Dynamics application must use either indirect or direct authorization initiation, as follows.
activityInit
method to use indirect authorization initiation.onCreate
method of the launcher activity's class.authorize
method to use direct authorization initiation.onResume
method of the launcher activity's class.onResume
is invoked again later in the application's execution cycle.See the GDAndroid page, under BlackBerry Dynamics Platform Connection, for an introduction to direct and indirect authorization.
Activities other than the launcher must either initiate indirect authorization, or be annotated for BlackBerry Dynamics monitoring, or extend a BlackBerry Dynamics replacement activity class.
activityInit
in the same way as the launcher activity, see above. A typical call would be: AndroidManifest.xml
file includes a meta-data tag with the name GDMonitorActivity
and the value true
, as shown in the following snippet: If monitoring is annotated on any activity then the application would typically have to set its state transition observer explicitly. See under Authorization State Notification Interfaces, above, for details of implicit and explicit observer setting.com.good.gd.Act
ivity
class, and overrides the onUserActivity()
method. In that case, the overriding method would have to call the super.onUserActivity()
method. Failure to call the base class method from an overriding method could result in abnormal termination of the application.GDStateListener
observer. See the GDAndroid page, under Authorization State Transition Notification Interfaces for details of implicit and explicit observer setting.The activities in an application can use a variety of the above methods, but each activity should use only one. For example, there shouldn't be a call to activityInit
and a meta-data annotation for the same activity.
Activities that use indirect authorization can extend native or third party activity classes, and aren't restricted to the BlackBerry Dynamics replacement classes. The BlackBerry Dynamics monitoring annotation can be applied even when source code isn't available, for example when the application includes a pre-built JAR library from a third party.
Note that activities other than the designated launcher shouldn't attempt to utilize direct authorization processing.
Some earlier versions of the software development kit for Android required that all activity classes extend a BlackBerry Dynamics replacement activity class, and didn't offer the other two options.