Class: GDAppKinetics

GDAppKinetics()

GDAppKinetics provides the functionality of AppKinetics the ability to securely communicate between applications

Methods

bringAppToFront(applicationId, onSuccess, onError)

Call this function to bring an app to the front of the device
Parameters:
Name Type Description
applicationId string ID of the app which should be brought to the front.
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions.
Source:
Example
window.plugins.GDAppKineticsPlugin.launchAppUsingUrlScheme("com.gd.exampleappkineticsfilebouncer",
    function(result) {
        alert("Should be able to launch this app " + result);
    },
    function(result) {
        alert("Application is failed to launch " + result);
    }
);

callAppKineticsService(applicationId, serviceId, version, method, parameters, array, onSuccess, onError)

Call this function to call any AppKinetics service.
Parameters:
Name Type Description
applicationId string ID of app to send to
serviceId string ID of the service
version string Version of the service
method string Method of the service
parameters object Parameters for the service as a dictionary
array array Array of attachements which must reside within secure storage, see copyFilesToSecureFileSystem
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions, check the error string returned for cause.
Source:
Example
window.plugins.GDAppKineticsPlugin.callAppKineticsService( "com.gd.exampleappkineticsfilebouncer",
                 "com.demo.generic.call2", "1.0.0.0", "testMethod-FileAttachment",
                { "arrayEntry-3Elements" : [ "arrayEntry1", "arrayEntry2", "arrayEntry3"],
                 "dictionary" : {"key1":"value1", "key2":"value2", "key3":"value3"}, "string" : "value" },
                [ "Brief GD Inter-Container Communication.pdf" ],     // File attachment
    function(result) {
        alert("Email sent");
    },
    function(result) {
        alert("Failed to send email");
    }
);

canLaunchAppUsingUrlScheme(onSuccess, onError)

Call this function to check if it is currently possible to open an app using an url scheme
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
window.plugins.GDAppKineticsPlugin.canLaunchAppUsingUrlScheme("http://address/App.plist",
    function(result) {
        alert("Should be able to launch this app " + result);
    },
    function(result) {
        alert("Application is failed to launch " + result);
    }
);

copyFilesToSecureFileSystem(onSuccess)

Copy files from "www/data" folder into secure file system to the "/data" path. While this is not an issue for applications using most APIs to write or read via GDCordova, there is a problem with moving files which are part of the application Bundle into the secure container. This api solves that problem and moves all files within the app bundle into the secure container.
Parameters:
Name Type Description
onSuccess function Callback function to invoke when the function returns successfully and the parameter to the success function is a string which contains the number of files moved.
Source:
Example
window.plugins.GDAppKineticsPlugin.copyFilesToSecureFileSystem(
    function(result) {
        alert("Number of files copied = " + result);
    }
);

launchAppUsingUrlScheme(urlToLaunch, onSuccess, onError)

Call this function to open an app using an URL scheme
Parameters:
Name Type Description
urlToLaunch string URL which is registered to the app which should be launched.
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions.
Source:
Example
window.plugins.GDAppKineticsPlugin.launchAppUsingUrlScheme("com.gd.exampleappkineticsfilebouncer",
    function(result) {
        alert("Should be able to launch this app " + result);
    },
    function(result) {
         alert("Application is failed to launch " + result);
    }
);

readyToProvideService(serviceName, versionOfService, onSuccess, onError)

Call this function to provide an AppKinetics service
Parameters:
Name Type Description
serviceName string Name of the service.
versionOfService string Version of the service
onSuccess function Callback function to invoke when the app receives an app kinetics request matching serviceName and service function. The parameter received in the function is a dictionary of the received parameters and file attachments in any.
onError function Callback function to invoke for error conditions, check the error string returned for cause.
Source:
Example
window.plugins.GDAppKineticsPlugin.readyToProvideService( "com.demo.generic.call", "1.0.0.0",
    function(result) {
        alert("Object received from " + result.applicationName + " with service " + result.serviceName + " version - " + result.version +
             " using method - " + result.method + " with parameters - " + JSON.stringify( result.parameters ) + " and attachments - " + JSON.stringify( result.attachments ));
    },
    function(result) {
        alert("Failed to receive email service");
    }
);

retrieveFiles(onSuccess, onError)

Call this function to retreive any waiting files but only for the file transfer service.
Parameters:
Name Type Description
onSuccess function Callback function to invoke when the function returns successfully with a parameter of an array of file paths of the received files.
onError function Callback function to invoke for error conditions or when no files are waiting.
Source:
Example
window.plugins.GDAppKineticsPlugin.retrieveFiles(
   function(result) {
       alert("Files retrieved");
   },
   function(result) {
       alert("Retrieve files is failed" + result);
    }
);

sendEmailViaGFE(array, subject, text, array, onSuccess, onError)

Call this function to send email via GFE (Good For Enterprise)
Parameters:
Name Type Description
array array Array of recipients email addresses
subject string Subject of the email
text string Text of the email
array array Array of attachements which must reside within secure storage, see copyFilesToSecureFileSystem
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions, check the error string returned for cause.
Source:
Example
window.plugins.GDAppKineticsPlugin.sendEmailViaGFE( ["sample@good.com"], "Test Email", "Hi, this is a test email", [],
    function(result) {
        alert("Email sent");
    },
    function(result) {
        alert("Failed to send email - unless GFE is not installed - check to see if GFE is not installed");
    }
);

sendFileToApp(filePath, applicationId, onSuccess, onError)

Call this function to an app to the front of the device
Parameters:
Name Type Description
filePath string FilePath path to the file to send.
applicationId string ID of the app to which the file is sent.
onSuccess function Callback function to invoke when the function returns successfully.
onError function Callback function to invoke for error conditions.
Source:
Example
window.plugins.GDAppKineticsPlugin.sendFileToApp("Brief GD Inter-Container Communication.pdf", "com.gd.exampleappkineticsfilebouncer",
    function(result) {
        alert("Should be able to send file " + result);
    },
    function(result) {
        alert("Send file is failed  " + result);
    }
);

setReceiveAttachmentsFunction(receiveFileFunction)

Call this function to set a function to be called for all files received but only for the file transfer service. Any currently waiting files will be delivered immediately.
Parameters:
Name Type Description
receiveFileFunction function Callback function to invoke when the function returns successfully with a parameter of an array of file paths of the received files.
Source:
Example
window.plugins.GDAppKineticsPlugin.setReceiveAttachmentsFunction(
    function(result) {
        alert("Files retrieved");
    }
);