Class: GDApplication

GDApplication()

The GD Application object provides access to information that is globally available to any BlackBerry Dynamics Application.

Methods

getApplicationConfig(onSuccess, onError)

This function returns a collection of configuration settings. The settings will have been entered in the Good Control (GC) console, and retrieved by the BlackBerry Dynamics run-time.
Parameters:
Name Type Description
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions.
Source:
Returns:
A JSON string representing a configuration dictionary of name/value pairs. Use the JSON.parse function to transform the data into a JavaScript object.
Key ConstantSetting
appHost Application server address. An application server address can be entered in the enterprise management console, in the application management user interface.
appPort Application server port number. An application port number can also be entered in the enterprise management console, in the application management user interface.
appConfig Application-specific configuration data. As well as the application server details, above, a free text can also be entered in the enterprise management console. Whatever was entered is passed through and made available to the application client here.
copyPasteOn Data Leakage security policy indicator. false means that enterprise security policies require that the end user must be prevented from taking any action that is classified as data loss or data leakage in the BlackBerry Dynamics Security Compliance Requirements document. true means that the above policy is not in effect, so the user is permitted to take those actions.
detailedLogsOn Logging level. 0 means that the logging level is low, and only minimal logs should be written. 1 means that the logging level is high, and detailed logs should be written. Detailed logs facilitate debugging of run-time issues. The BlackBerry Dynamics run-time will automatically adjust its logging according to the configured setting. The setting is present in the API so that the application can adjust its logging consistently with the run-time.
userId Enterprise e-mail address. The end user will have entered their e-mail address in the enterprise activation user interface when the application was run for the first time, during authorization processing. This will be the same as the e-mail address to which the access key was sent when the user was provisioned in the enterprise management console.
Example
function success(result) {
    try {
        JSON.parse(result);
        alert("Successfully parsed the configuration JSON format: " + result);
    } catch(e) {
        alert("Unable to parse configuration JSON format: " + result);
    }
};

function fail(result) {
    alert("An error occurred while retrieving the application configuration: " + result);
};

function getApplicationConfiguration(){
    window.plugins.GDApplication.getApplicationConfig(success,fail);
};

getVersion(onSuccess, onError)

This function returns a string containing the library version in major.minor.build format.
Parameters:
Name Type Description
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions.
Source:
Returns:
String
Example
function success(result) {
    alert("Retrieved the version data: " + result);
};

function fail(result) {
    alert("An error occurred while retrieving the application version: " + result);
};


function getApplicationVersion(){
    window.plugins.GDApplication.getVersion(success,fail);
};

showPreferenceUI(onSuccess, onError)

Call this function to show the BlackBerry Dynamics (GD) preferences user interface (UI). This is the UI in which the end user sets any options that are applied by the library directly, without reference to the application. This includes, for example, changing their security password. This function enables the GD preferences UI to be included in the application's own user interface.
Parameters:
Name Type Description
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions.
Source:
Example
function success(result) {
    alert("Successful response: " + result);
};

function fail(result) {
    alert("An error occurred while show preference UI: " + result);
};


function showPreferenceUI(){
    window.plugins.GDApplication.showPreferenceUI(success, fail);
};