Click or drag to resize
GDWindows Class
BlackBerry Dynamics Runtime object interface, including authorization.
Inheritance Hierarchy
SystemObject
  GDGDWindows

Namespace:  GD
Assembly:  GD (in GD.dll) Version: 255.255.255.255
Syntax
public sealed class GDWindows

The GDWindows type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberInstance
Access the instance of GDWindows singleton class.
Public propertySecureFolder
Gets the root folder of the BlackBerry Dynamics secure file system.
Top
Methods
  NameDescription
Public methodAuthorize
Connect to the BlackBerry Dynamics infrastructure.
Public methodAuthorizeAutonomously
Connect to the BlackBerry Dynamics infrastructure in background.
Public methodCanAuthorizeAutonomously
Check whether it is possible to authorize in background.
Public methodCustomizeBlockedMessage
Customize the BlackBerry Dynamics blocked screen.
Public methodCustomizeBrandColor
Configure the brand color of the BlackBerry Dynamics user interface.
Public methodCustomizeLogo(ImageSource)
Configure logo displayed by the BlackBerry Dynamics user interface.
Public methodCustomizeLogo(ImageSource, ImageSource)
Configure logo displayed by the BlackBerry Dynamics user interface.
Public methodCustomizeWipedMessage
Customize the BlackBerry Dynamics wiped screen.
Public methodEnteringBackground
Must be called when the application transitions to Suspended state from some other state.
Public methodEnteringForeground
Must be called when the application transitions from Suspended state to Running state.
Public methodEquals (Inherited from Object.)
Public methodGetApplicationConfig
Get application configuration from the BlackBerry management console.
Public methodGetApplicationPolicy
Get application-specific policy settings from the BlackBerry management console.
Public methodGetApplicationPolicyString
Get application-specific policy settings from the BlackBerry management console, as string.
Public methodGetFrame
Get root Frame of application managed by BlackBerry Dynamics Runtime that should be used instead of default one.
Public methodGetHashCode (Inherited from Object.)
Public methodGetServiceProvidersAsync
Get providers of shared services.
Public methodGetServiceProvidersAsync(GDServiceProviderType, String, String)
Discover providers of a specific shared service.
Public methodGetType (Inherited from Object.)
Public methodInitialize
Initializes BlackBerry Dynamics Runtime. After initialization GDAppEvent event with type GDAppEventReadyToAuthorize is sent to HandleGDMessage (GDAppEventHandler delegate).
Public methodInitialize(String)
Initializes BlackBerry Dynamics Runtime. After initialization GDAppEvent event with type GDAppEventReadyToAuthorize is sent to HandleGDMessage (GDAppEventHandler delegate). Allows loading additional settings.
Public methodInitialize(PackageVersion)
Initializes BlackBerry Dynamics Runtime. After initialization GDAppEvent event with type GDAppEventReadyToAuthorize is sent to HandleGDMessage (GDAppEventHandler delegate). Allows application version overriding.
Public methodInitialize(PackageVersion, String)
Initializes BlackBerry Dynamics Runtime. After initialization GDAppEvent event with type GDAppEventReadyToAuthorize is sent to HandleGDMessage (GDAppEventHandler delegate). Allows application version overriding and loading additional settings.
Public methodIsInForeground
Check if current application window is activated.
Public methodOnActivated
Must be invoked when the application is activated by some means other than normal launching.
Public methodOnFileActivated
Must be invoked when the application is activated through file-open.
Public methodShowPreferenceUI
Open the BlackBerry Dynamics preferences user interface.
Public methodToString (Inherited from Object.)
Top
Events
  NameDescription
Public eventHandleGDMessage
This event is called on authorization status changes and after receiving remote settings, services, policy or data plan update.
Top
Remarks

This class represents the application's connection to the BlackBerry Dynamics Runtime on the device, and hence to the wider BlackBerry Dynamics platform infrastructure.

The API includes a number of methods that the application must call at particular points in the application execution cycle. The application must also register a handler for events dispatched by this Runtime (HandleGDMessage). Calling the methods, and handling the events correctly, ensures compliance with enterprise security policies. This API also includes a number of miscellaneous methods for various purposes, such as setting a custom logo for display in the user interface.

The application must initialize the BlackBerry Dynamics interface object, using this API, prior to using any other BlackBerry Dynamics API. Initialization will only succeed if the end user has been provisioned in the enterprise's BlackBerry Dynamics management console server, and is entitled to use the application.

The user's entitlement to the application may later be revoked or temporarily withdrawn. For example, temporary withdrawal may take place if the user is inactive for a period of time. In either case, the application will be notified with an event or callback from this API.

Successful initialization of the BlackBerry Dynamics interface object enables the BlackBerry Dynamics proxy infrastructure within the URL Loading System.

There is a helper base class for applications utilizing BlackBerry Dynamics Runtime (Application) that already takes care of most of this object interaction.

See also:

BlackBerry Dynamics management console overview for application developers
BlackBerry Dynamics Administrator and Developer Overview for an introduction to BlackBerry Dynamics.
Application for a base class for applications using BlackBerry Dynamics.

BLACKBERRY DYNAMICS PLATFORM CONNECTION

Establishing a connection to the BlackBerry Dynamics platform requires authorization of the end user, and of the application. Both authorizations are initiated by a single call to the Authorize method.

The Authorize method call is typically made when the application receives a GDAppEventReadyToAuthorize, in the HandleGDMessage event handler. It is possible to start authorization process any time in the future, after this event is received.

Authorization generally includes establishing a data connection to the BlackBerry Dynamics proxy infrastructure, and hence to the enterprise that provisioned the end user. In addition, authorization will also include any necessary registration of the device, at the BlackBerry Dynamics Network Operation Center (infrastructure activation), and at the enterprise (enterprise activation). See under ACTIVATION, below, for more details.

Authorization may include user interaction, see the documentation of the Authorize method, below, for details. All user interaction that is part of authorization takes place in a user interface that is part of the SDK library, not part of the application.

The authorization API is state-based and asynchronous. The initiation function generally returns immediately. Success or failure of authorization is then notified to the application code later, as a transition of the authorization state. The application should generally wait to be notified of transition to the "authorized" state before attempting to utilize any other SDK APIs (GDAppEventAuthorized).

Further changes to the authorization state can take place, and are notified to the application in the same way. See under AUTHORIZATION STATE, below.

See also:

Enterprise Simulation mode below for instructions on building an application to run in a special limited mode in which authorization with the enterprise is only simulated.
Network Operation Center server addresses on the BlackBerry Developer Network for IP address and port number details of the BlackBerry Dynamics Network Operation Center services.

AUTHORIZATION STATE

The SDK maintains the authorization state of the application. The SDK APIs that can be utilized by the application depend on its current authorization state.

The initial state of the application when it starts is not authorized. In this state the application can utilize the authorization processing initiation API but cannot utilize any principal SDK APIs, such as secure store access and secure communication.

After authorization has been initiated and has succeeded, the application enters the authorized state. The principal SDK APIs can then be utilized.

Authorization of the end user may be temporarily withdrawn, in which case the application enters the locked state. This would happen when, for example, the user does not interact with the application for an extended period and the enterprise inactivity time out expires. Note that the authorization of the application itself has not been withdrawn in this state, only the authorization of the end user to access the application's data.

In the locked state, the SDK superimposes an unlock screen on the application user interface to prevent the user from interacting with the application or viewing its data. Note that the SDK does not block the whole device user interface, which means that native notification features and other ancillary mechanisms could still be utilized by the application. The application must not cause sensitive enterprise data to be displayed through these features and mechanisms when in the locked state. The application can continue to utilize the principal SDK APIs, in the background.

After a temporary withdrawal ends, the application returns to the authorized state. This would happen when, for example, the user enters their security password in the unlock screen.

Authorization may also be permanently withdrawn, in which case the application enters the wiped state. This would happen when, for example, the end user's entitlement to the application is removed by the enterprise administrator. In the wiped state, the application cannot utilize the principal SDK APIs.

Transitions of the authorization state are notified by dispatching a GDAppEvent object to the HandleGDMessage event handler in the application. The event will have a number of attributes, including a type value that indicates whether the user is now authorized.

The authorization states and their corresponding event type values are listed in the following table.

StateDescriptionGDAppEventType value
Not authorizedInitial state. The application can initiate authorization, but cannot utilize the principal SDK APIs.None
AuthorizedEither the user has just been authorized to access the application, following authorization processing, or a condition that caused authorization to be withdrawn has been cleared. The application can utilize the principal SDK APIs.GDAppEventAuthorized
LockedAuthorization of the user has been temporarily withdrawn, for example due to inactivity. User interaction is blocked. The application can still utilize the principal SDK APIs.GDAppEventNotAuthorized
WipedAuthorization of the user has been permanently withdrawn, for example due to violation of an enterprise policy for which the enforcement action is to wipe the secure container. The application cannot use any SDK APIs.GDAppEventNotAuthorized This is the same event type as the Locked state transition event.

The transitions in the above table are also shown in the Authorization state transition diagram below.

The SDK user interface includes all the necessary screens and messages to inform the user of the authorization state. The application code needs only to ensure:

  • That it does not bypass the SDK user interface.
  • That it does not attempt to access the principal SDK APIs prior to authorization.
  • That it does not attempt to access the principal SDK APIs after the authorization state has changed to wiped.

API RESTRICTIONS

The application cannot use any of the principal BlackBerry Dynamics APIs before authorization has succeeded. If the application attempts to do so, the BlackBerry Dynamics Runtime generates an assertion, which results in the application being terminated.

The BlackBerry Dynamics Runtime does not generate assertions for transient conditions, but only for apparent programming errors in the application. Consequently, these assertions are only expected when the application is in development, and not when the application is in production. The failure message of the assertion will describe the programming error.

The recommended approach is that the application should be allowed to terminate, so that the failure message can be read on the console. The failure message will describe the programming error, which can then be corrected.

ACTIVATION

In BlackBerry Dynamics, activation refers to a number of registration procedures that must be completed in order to access all platform capabilities. Once a particular activation has been completed, registration credentials are stored on the device. This means that each activation need only be processed once.

Activations are generally transparent to the application. The application will call a BlackBerry Dynamics authorization method, and the runtime will process whichever activations are required.

There are two activations in BlackBerry Dynamics.

Infrastructure activationRecognition of the device as a terminal by the BlackBerry Limited central server.
Enterprise activationAssociation of the terminal with a provisioned end user at the enterprise. This requires the user to enter an activation key. The key can be sent to the user by email when they are provisioned, or made available through the BlackBerry Dynamics management console self-service interface.

See also:

Enterprise Simulation mode below for instructions on building an application to run in a special limited mode in which there is no enterprise activation.
BlackBerry Dynamics management console overview for application developers for details on how to provision a user for development purposes.

APPLICATION IDENTIFICATION

Unique BlackBerry Dynamics application identifiers (BlackBerry Dynamics App IDs) are used to identify BlackBerry Dynamics applications. BlackBerry Dynamics App IDs are used in the application, and in the management user interface at the enterprise, the BlackBerry Dynamics management console.

In the application, the BlackBerry Dynamics Entitlement ID is set by the authorization call, as documented in the Authorize method reference, below. In the BlackBerry Dynamics management console, the BlackBerry Dynamics Entitlement ID is entered as part of application registration.

BlackBerry Dynamics App IDs are textual and follow a typical naming convention. The reversed Internet domain of the application developer forms the initial part of the BlackBerry Dynamics Entitlement ID. For example, applications developed by BlackBerry Limited have IDs that begins with "com.blackberry." since BlackBerry Limited owns the blackberry.com domain.

The rest of the ID is made up of the application's name, possibly preceded by a number of categories and sub-categories. Categories and sub-categories are separated by full stops. For example, the ID of an example BlackBerry Dynamics remote database application, made by BlackBerry Limited, could be: "com.blackberry.bbd.examples.remotedb".

Formally, the syntax of a BlackBerry Dynamics Entitlement ID is a string that complies with the following:

  • Contains only the following ASCII characters: hyphen (dash), full stop (period), numeric digit, lower-case letter.
  • Conforms to the <subdomain> format defined in section 2.3.1 of RFC1035.

In Windows application BlackBerry Dynamics Entitlement ID must be defined in application manifest as /Package/Applications/Application/@Id attribute, as show below.

<Applications>
    <Application Id="com.good.gd.examples.remotedb" <!-- BlackBerry Dynamics Entitlement ID in reverse-DNS notation -->
                 Executable="$targetnametoken$.exe"
                 EntryPoint="RemoteDB.Windows.App">
        (...)
    </Application>
</Applications>

NATIVE APPLICATION IDENTIFIERS

The BlackBerry Dynamics Entitlement ID and Entitlement Version are BlackBerry specific metadata and are independent of the identifiers needed by the application platform. To take advantage of many BlackBerry Dynamics features, such as Easy Activation, multi-authentication delegation, and the BlackBerry Dynamics shared services framework, developers need to set up a map in BlackBerry Dynamics management console between your defined BlackBerry Dynamics Entitlement ID and the native identifiers on the platforms for which your application is distributed. The native platforms have no knowledge of the BlackBerry Dynamics Entitlement ID; thus the mapping is needed for the operating systems to take over the actual function of the app.

As a Native Application ID a Package Family Name value is used. It can be found in manifest GUI editor in Visual Studio IDE:

Entering Native Application ID in the BlackBerry Dynamics management console enables BlackBerry Dynamics Application to leverage from BlackBerry Inter-Container Communication (ICC). Specifically this is required if application is going to be used as Service Provider or Authentication Delegate. Native Identifier (Package Family Name) should be registered for the application in the BlackBerry Dynamics management console by filling Windows 10 (UWP) Package Family Name field when editing BlackBerry Dynamics Entitlement ID section. For more details, refer to the "Getting Started Guide".

APPLICATION USER INTERFACE RESTRICTIONS

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 BlackBerry Dynamics Runtime.

The application must use the GetFrame method instead of creating a new Frame object during setting up application context e.g. in OnLaunched(LaunchActivatedEventArgs) callback. Always make sure to use Frame acquired from GetFrame instead of using default one - it's necessary to intercept user UI interaction if necessary. For more details please refer to GetFrame method and Application class.

The application must close any open modal dialogs when entering background. This can be done in the Activated event handler.

BUILD-TIME CONFIGURATION

The following build-time configuration is mandatory for all BlackBerry Dynamics applications.

The application must register a specific Protocol name on the device. This enables BlackBerry Inter-Container Communication (ICC), which is required for enforcement of any authentication delegation policy set by the enterprise. The Protocol name is the always the same: gd-sc3. An additional scheme must be declared that is the same as the URL type with gd-sc3. and then the BlackBerry Dynamics Application Version appended. The Protocol Names would be declared in the packages Package.appxmanifest file, as usual.

If application has to provide certificate sharing functionallity it is mandatory to define gd-sc3.certificate.sharing protocol.

The Package.appxmanifest file of any of the sample applications supplied with the BlackBerry Dynamics SDK can be used as a guide.

Alternatively, add the following XML to the application's Package.appxmanifest file, using a text editor, as child nodes of /Package/Applications/Application.

<Extensions>
  <uap:Extension Category="windows.protocol">
    <uap:Protocol Name="gd-sc3">
      <uap:DisplayName>BlackBerry Dynamics Protocol</uap:DisplayName>
    </uap:Protocol>
  </uap:Extension>
  <uap:Extension Category="windows.protocol">
    <uap:Protocol Name="gd-sc3.1.0.0.0">
      <uap:DisplayName>BlackBerry Dynamics Discovery Protocol</uap:DisplayName>
    </uap:Protocol>
  </uap:Extension>
</Extensions>
<uap:Extension Category="windows.protocol">
  <uap:Protocol Name="gd-sc3.certificate.sharing">
    <uap:DisplayName>Certificate Sharing Discovery Protocol</uap:DisplayName>
  </uap:Protocol>
</uap:Extension>

The BlackBerry Dynamics Runtime checks the configuration during authorization processing. The end user will not be authorized if the configuration is incorrect.

The above configuration also enables BlackBerry Dynamics Application-Based Services, see the GDService class reference.

COMPATIBILITY WITH SDK FOR WINDOWS 8.1

By default, applications built with the SDK for UWP cannot communicate with applications built with the SDK for Windows 8.1, because the SDK for UWP uses an alternative implementation to BlackBerry Inter-Container Communication (ICC) implementation. To enable intercommunication, follow the advice here.

A requirement for BlackBerry Dynamics Application for UWP to establish connection with BlackBerry Dynamics Windows (Phone) 8.1 Application is to define additional native identifier in the BlackBerry Dynamics management console. A Package Name (not Package Family Name; can be found in Package.appxmanifest file in the /Package/Identity/@Name attribute) of BlackBerry Dynamics Application for UWP must be entered in to the Windows 8.1 Application ID and/or Windows Phone 8.1 Application ID field when editing BlackBerry Dynamics Entitlement ID section. For more details, refer to the "Getting Started Guide".

Additional requirement is to define all legacy (SC2) application extensions, as was done for SDK for Windows (Phone) 8.1. The application must register a specific Protocol name and two File Type associations.

The Protocol name is the same as Package Name, with sc2 prefix. For example, if the Package Name of the application was 9fe889c7-8860-469e-96c0-973221359b8f then the Protocol name declared would be sc29fe889c7-8860-469e-96c0-973221359b8f.

Fist, required file type association must register extension named as Package Name, with .sc2-cmd- prefix. For example, if the Package Name of the application was 9fe889c7-8860-469e-96c0-973221359b8f then the File Type would be declared as .sc2-cmd-9fe889c7-8860-469e-96c0-973221359b8f.

Second, optional (only to provide compatibility with BlackBerry Dynamics Application-Based Services for Windows 8.1) file type registered must be the same as Package Name, with .sc2-ak- prefix. For example, if the Package Name of the application was 9fe889c7-8860-469e-96c0-973221359b8f then the File Type declared would be .sc2-ak-9fe889c7-8860-469e-96c0-973221359b8f.

The Package.appxmanifest file of any of the sample applications supplied with the BlackBerry Dynamics SDK can be used as a guide.

Alternatively, add the following XML to the application's Package.appxmanifest file, using a text editor, as child nodes of /Package/Applications/Application/Extensions. Change all occurrences of 9fe889c7-8860-469e-96c0-973221359b8f to the Package Name of yours application (obeying rules mentioned above).

<uap:Extension Category="windows.protocol">
  <uap:Protocol Name="sc29fe889c7-8860-469e-96c0-973221359b8f">
    <uap:DisplayName>AppKinetics Service Protocol</uap:DisplayName>
  </uap:Protocol>
</uap:Extension>
<uap:Extension Category="windows.fileTypeAssociation">
  <uap:FileTypeAssociation Name="appkinetics-payload">
    <uap:DisplayName>AppKinetics Service Extension</uap:DisplayName>
    <uap:EditFlags OpenIsSafe="true" />
    <uap:SupportedFileTypes>
      <uap:FileType>.sc2-ak-9fe889c7-8860-469e-96c0-973221359b8f</uap:FileType>
    </uap:SupportedFileTypes>
  </uap:FileTypeAssociation>
</uap:Extension>
<uap:Extension Category="windows.fileTypeAssociation">
  <uap:FileTypeAssociation Name="command-payload">
    <uap:DisplayName>AppKinetics Service Extension</uap:DisplayName>
    <uap:EditFlags OpenIsSafe="true" />
    <uap:SupportedFileTypes>
      <uap:FileType>.sc2-cmd-9fe889c7-8860-469e-96c0-973221359b8f</uap:FileType>
    </uap:SupportedFileTypes>
  </uap:FileTypeAssociation>
</uap:Extension>

ENTERPRISE SIMULATION MODE

BlackBerry Dynamics applications can be run in a mode in which the authentication of the end user at the enterprise is only simulated. This is enterprise simulation mode.

Enterprise simulation mode is for use when developers are developing new applications, or migrating existing applications.

In enterprise simulation mode, there is no need for a valid activation key, no communication with BlackBerry Dynamics servers at the enterprise, and in fact no need for these servers even to be in place. Communication with the BlackBerry Dynamics Network Operation Center does still take place in enterprise simulation mode.

Enterprise simulation mode is not suitable for production deployment.

BlackBerry Dynamics applications can only be run in enterprise simulation mode on a Windows Phone device emulator, that comes with the Visual Studio. Note, that simulation mode isn't available on Windows Tablet device simulator.

To enable enterprise simulation mode, add an entry to the application's settings.json file as follows:

"GDLibraryMode": "GDEnterpriseSimulation"

The path to settings.json file must be passed to the Initialize(String) method. Absence of this file path means that the application will process default enterprise authentication.

Communication with the BlackBerry Dynamics Network Operation Center (NOC) takes place during initial activation of the application, even in enterprise simulation mode. This means that the NOC must be accessible from the environment in which the application is executing.

When this mode is enabled the application will behave differently, as follows:

  • "Simulated" appears in the SDK user interface, as shown in the screen capture below.
  • Any values can be entered in the SDK set-up screen, and will be accepted for enterprise activation. A value that is not an email address can be entered in the email address field. Any value that is long enough can be used as the access key.
  • No information will be sent to the BlackBerry Dynamics enterprise servers, not even the values entered in the set-up screen.
  • The provisioning and policy set-up flow will be simulated in the user interface.
  • A hard-coded set of security and compliance policies will be in operation. In these policies, authentication is not delegated.
  • If run on a real device, not a simulator, the application will be wiped.
  • Any attempt to change the mode of an application that is already installed from default to simulated will also result in a wipe.
  • There is no lost password recovery.
  • BlackBerry Inter-Container Communication (ICC) cannot be used. This means that the BlackBerry Dynamics Services API cannot be used.

The Secure Storage, Secure Communication, and Push Channel APIs are all available in enterprise simulation mode. The communication APIs will however not be able to connect to any enterprise application servers through the BlackBerry Dynamics proxy infrastructure. Direct connections to enterprise application servers can still be made, for example if the device emulator is running on a machine that is on the enterprise LAN or VPN.

Examples

The following code snippets illustrate some common tasks.

See the Application class reference. This base application class take cares of most of the common task mentioned below.

EARLY RUNTIME OBJECT INITIALIZATION

The following snippet shows early initialization of the SDK object.

private Application()
{
    Suspending += Application_Suspending;
    Resuming += Application_Resuming;
}

private void Application_Resuming(object sender, object e)
{
    // Informs SDK that application is going to enter foreground.
    GDWindows.Instance.EnteringForeground();
}

private void Application_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
{
    // Informs SDK that application is going to enter background. 
    var deferral = e.SuspendingOperation.GetDeferral();
    GDWindows.Instance.EnteringBackground();
    deferral.Complete();
}

BLACKBERRY DYNAMICS INITIALIZATION ROUTINE

Following snippet shows common BlackBerry Dynamics Runtime initialization process and proper applications window context setup.

private void InitializeGD(object eventArgs)
{
    Frame rootFrame = Window.Current.Content as Frame;

    // Do not repeat app initialization when the Window already has content,
    // just ensure that the window is active
    if (rootFrame == null)
    {
        // Access BlackBerry Dynamics Runtime instance
        var gd = GDWindows.Instance;

        // Create a Frame to act as the navigation context and navigate to the first page
        rootFrame = gd.GetFrame();

        // Set the default language
        rootFrame.Language = SWindows.Globalization.ApplicationLanguages.Languages[0];

        // Place the frame in the current Window
        Window.Current.Content = rootFrame;

        // App specific initialization goes here
        Initialize(eventArgs);

        // Register handler for BlackBerry Dynamics Runtime events
        // You will receive there e.g. GDAppEventReadyToAuthorize event
        gd.HandleGDMessage += HandleGDMessage;

        // Start BlackBerry Dynamics initialization process
        gd.Initialize(Package.Current.InstalledLocation.Path + @"\settings.json");
    }

    // Ensure frame content won't be null
    if (rootFrame.Content == null)
    {
        // Removes the turnstile navigation for startup
        if (rootFrame.ContentTransitions != null)
        {
            _transitions = new TransitionCollection();
            foreach (var c in rootFrame.ContentTransitions)
            {
                this._transitions.Add(c);
            }
        }
        rootFrame.ContentTransitions = null;
        rootFrame.Navigated += Frame_FirstNavigated;

        // Tell app to navigate to the first page here
        NavigateToFirstPage(rootFrame, eventArgs);
    }

    // Ensure the current window is active
    Window.Current.Activate();
}

private void Frame_FirstNavigated(object sender, NavigationEventArgs e)
{
    // Restores the content transitions after the app has launched.
    var rootFrame = sender as Frame;
    if (rootFrame != null)
    {
        rootFrame.ContentTransitions = this._transitions;
        rootFrame.Navigated -= Frame_FirstNavigated;
    }
}

APPLICATION ENTRY POINTS

The following snippet shows how and which application entry points should be handled.

// Entry point for ordinary application launch.
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    base.OnLaunched(args);
    InitializeGD(args);
}

// Entry point for handling incoming URI requests. Used i.e. for AuthDelegation commands interchange.
protected override void OnActivated(IActivatedEventArgs args)
{
    base.OnActivated(args);
    GDWindows.Instance.OnActivated(args);
    InitializeGD(args);
}

AUTHORIZATION

The following snippet shows initiation of BlackBerry Dynamics authorization. This delegate needs to be previously registered in SDK. See BLACKBERRY DYNAMICS INITIALIZATION ROUTINE section above for details.

// Entry point for SDK to Application communication. All messages sent from SDK are handled by this method.
protected async virtual void HandleGDMessage(GDAppEvent appEvent)
{
    if (appEvent.type == GDAppEventType.GDAppEventReadyToAuthorize)
    {
        // This can be invoked any time after GDAppEventReadyToAuthorize is received
        await Task.Run(() =>
        {
            GDWindows.Instance.Authorize();
        });
    }
}
After executing the above code, the application would wait for its HandleGDMessage delegate to be invoked. The invocation would have an event type of GDAppEventAuthorized if the user was authorized. After that, the application could make full use of all BlackBerry Dynamics capabilities.

See Also