Click or drag to resize
Application Class
Abstract base class for all applications using BlackBerry Dynamics SDK for Windows Runtime.
Inheritance Hierarchy

Namespace:  GDEx
Assembly:  GDEx.UAP (in GDEx.UAP.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public abstract class Application : Application

The Application type exposes the following members.

Constructors
  NameDescription
Public methodApplication
Creates GD based Application instance. Must be called explicitly from derived class.
Top
Properties
  NameDescription
Public propertyDebugSettings
Gets an object that declares how the app behaves when run in a debug environment.
(Inherited from Application.)
Public propertyDispatcher
Access application/windows specific dispatcher.
Public propertyFocusVisualKind (Inherited from Application.)
Public propertyFrame
Shortcut for accessing application root Frame.
Public propertyRequestedTheme
Gets or sets a value that determines the light-dark preference for the overall theme of an app.
(Inherited from Application.)
Public propertyRequiresPointerMode (Inherited from Application.)
Public propertyResources
Gets a collection of application-scoped resources, such as styles, templates, and brushes.
(Inherited from Application.)
Top
Methods
  NameDescription
Public methodExit
Shuts down the app.
(Inherited from Application.)
Protected methodHandleGDMessage
Entry point for GD SDK -> Application communication. All messages sent from GD SDK are handled by this method.
Protected methodInitialize
Virtual method called when application can perform Window/Frame related initialization. When called Window.Current.Content is already initialized to GD Frame and can be accessed by Frame property.
Protected methodNavigate
Shortcut method for performing navigation on application root frame.
Protected methodNavigateToFirstPage
Abstract method called when application should navigate to the very first screen. This happens even before authorization process begins. In most cases application should navigate to splash screen or similar.
Protected methodOnActivated
Entry point for handling incoming URI requests. Used i.a. for AuthDelegation commands interchange.
(Overrides ApplicationOnActivated(IActivatedEventArgs).)
Protected methodOnBackgroundActivated (Inherited from Application.)
Protected methodOnCachedFileUpdaterActivated
Invoked when the application is activated due to an activation contract with ActivationKind as CachedFileUpdater.
(Inherited from Application.)
Protected methodOnFileActivated
Entry point for handling file opening requests. Used i.a. for AppKinetics payload interchange.
(Overrides ApplicationOnFileActivated(FileActivatedEventArgs).)
Protected methodOnFileOpenPickerActivated
Invoked when the application is activated through file-open dialog association.
(Inherited from Application.)
Protected methodOnFileSavePickerActivated
Invoked when the application is activated through file-save dialog association.
(Inherited from Application.)
Protected methodOnLaunched
Entry point for ordinary application launch.
(Overrides ApplicationOnLaunched(LaunchActivatedEventArgs).)
Protected methodOnSearchActivated
Invoked when the application is activated through a search association.
(Inherited from Application.)
Protected methodOnShareTargetActivated
Invoked when the application is activated through sharing association.
(Inherited from Application.)
Protected methodOnWindowCreated
Stores dispatcher reference for current window context.
(Overrides ApplicationOnWindowCreated(WindowCreatedEventArgs).)
Top
Events
  NameDescription
Public eventEnteredBackground (Inherited from Application.)
Public eventLeavingBackground (Inherited from Application.)
Public eventResuming
Occurs when the application transitions from Suspended state to Running state.
(Inherited from Application.)
Public eventSuspending
Occurs when the application transitions to Suspended state from some other state.
(Inherited from Application.)
Public eventUnhandledException
Occurs when an exception is raised by application code, forwarded from the native level. Applications can mark the occurrence as handled in event data.
(Inherited from Application.)
Top
Remarks
To be able to launch BlackBerry Dynamics based application some changes are required in application manifest file:
  1. REQUIRED: BlackBerry Dynamics Entitlement ID (in reverse-DNS notation) must be defined as Id parameter of Application node. It allows SDK to identify your application during BlackBerry Limited server infrastructure communication.
  2. REQUIRED: Two application specific protocols with name: gd-sc3 and gd-sc3.[gd-app-version] name must be registered as application Extension child node. This enables BlackBerry Inter-Container Communication (ICC): Authentication Delegation and Application-Based Services.

For more details and code snippets please refer to Examples section, Build-Time Configuration or Compatibility with SDK for Windows 8.1 section of GDWindows class reference.

Examples

Required BlackBerry Dynamics Entitlement ID definition in application manifest:

<Applications>
    <Application Id="com.gd.based.application" <!-- BlackBerry Dynamics Entitlement ID in reverse-DNS notation -->
                 Executable="$targetnametoken$.exe"
                 EntryPoint="Sample.Windows.App">
        (...)
    </Application>
</Applications>
Required protocols definition (<Extension Category="windows.protocol">) in application manifest:
<Applications>
    <Application Id="com.gd.based.application" Executable="$targetnametoken$.exe" EntryPoint="Sample.Windows.App">
        <Extensions>
            <uap:Extension Category="windows.protocol">
                <!-- Protocol name must be set to "gd-sc3" -->
                <uap:Protocol Name="gd-sc3">
                    <uap:DisplayName>Sample windows app protocol</uap:DisplayName>
                </uap:Protocol>
            </uap:Extension>
            <uap:Extension Category="windows.protocol">
                <!-- Protocol name must be set to "gd-sc3.<gd-app-version>" -->
                <uap:Protocol Name="gd-sc3.1.0.0.0">
                    <uap:DisplayName>Sample windows app protocol</uap:DisplayName>
                </uap:Protocol>
            </uap:Extension>
        </Extensions>
        (...)
    </Application>
</Applications>

Minimal, sample implementation required to use all SDK benefits for App.xaml.cs is:

using System;
using Windows.UI.Xaml.Controls;
using GDEx;
using GD;

namespace SampleApp
{
    sealed partial class App : GDEx.Application
    {
        public App()
        {
            this.InitializeComponent();
        }

        protected override void NavigateToFirstPage(Frame frame, object eventArgs)
        {
            // Navigate to very first screen of your application (before authorization process begins).
            // Typically it will be a splash screen or similar.
            frame.Navigate(typeof(SplashView), eventArgs);
        }

        protected override async void HandleGDMessage(GDAppEvent appEvent)
        {
            // Remember to call base class implementation, as some events are processed
            // automatically inside the base class (e.g. GDAppEventType.GDAppEventReadyToAuthorize).
            base.HandleGDMessage(appEvent);

            if (appEvent.type == GDAppEventType.GDAppEventAuthorized)
            {
                // When user authorization succeed, you can navigate to main page of your application.
                await Navigate(typeof(MainPage));
            }
        }
    }
}
For App.xaml:
<gdex:Application
    x:Class="SampleApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:gdex="using:GDEx">
</gdex:Application>

You can use JSON file with additional settings, e.g. to enable Enterprise Simulation mode or to change console logger settings. Sample settings.json file can look like this:

{
    "GDLibraryMode" : "GDEnterpriseSimulation",
    "GDConsoleLogger" : [ "GDFilterNone" ]
}
Apply that setting to BlackBerry Dynamics SDK by passing path to the JSON file to Application constructor, e.g.:
namespace SampleApp
{
    sealed partial class App : GDEx.Application
    {
        public App() : base(Package.Current.InstalledLocation.Path + @"\settings.json")
        {
            this.InitializeComponent();
        }
    }

    (...)
}
See Enterprise Simulation mode section for more details.

See Also