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.
BlackBerry Dynamics will, from time to time, take control of the application user interface. It does this in order to enforce enterprise security policies. A BlackBerry Dynamics application's user interface (UI) is divided into the following parts, for the purposes of control.
Runtime UI. The screens and other user interface elements that are built in to the BlackBerry Dynamics runtime. This includes the screens on which the end user sets and enters their security password, for example.
Application UI. All user interface elements that aren't part of the runtime UI, above. These could be defined in the application code or in another third party library, for example.
When BlackBerry Dynamics takes control of the user interface, the runtime UI is displayed in front of the application UI, which is therefore hidden.
If the application UI is in front, general user interface programming features can be used, with the following restrictions.
window
property of the main app delegate, see under Access to the application window, below.If the runtime UI is in front:
The runtime UI will only stay in front for as long as is necessary to enforce enterprise policies. For example, if the user is required by policy to enter their password then the runtime UI will stay in front until they have done so. After that, the runtime UI will be removed and the application UI will be revealed.
The application code can monitor which UI is in front, see the code snippets for Monitoring user interface control, below.
The main UIApplication
instance and the main app delegate have a number of window properties whose values are modified by BlackBerry Dynamics. Supported use is as follows.
window
property.UIWindow
instance, in which to display the application UI. The object will be suitable to have its root view controller set to the initial view controller of the main storyboard, for example. See under Instantiating the application user interface, below, for sample code.UIApplication
keyWindow
property.UIApplication
windows
property.The following code snippets illustrate some common tasks.
The following code snippet shows an approach, sometimes known as programmatic storyboard loading, to instantiation of the application user interface.
The above snippet illustrates the following approach.
didFinishLaunchingWithOptions:
implementation (not shown in the snippet).The following code snippets shows how to monitor user interface control by using the native notification mechanism, NSNotification
.
The above snippet illustrates the following.
NSNotification
when its state changes. The constant GDStateChangeNotification
gives the name of the notification.NSNotificationCenter
addObserver
.GDiOS.state
object, which will be an instance of the GDState
class. The userInterfaceState
property will have the value GDUIStateGDLibraryInFront
if the runtime UI is in front.The following code snippets shows how to monitor user interface control by using key-value observing (KVO).
The above snippet illustrates the following.
GDiOS.state
object, which will be an instance of the GDState
class.NSObject
addObserver
.GDKeyUserInterfaceState
constant, which will be the GDState
userInterfaceState
property. It will take the value GDUIStateGDLibraryInFront
if the runtime UI is in front.