Constructor
new GDAppKinetics()
Members
(constant) storageLocation :string
Use this constant to get platform specific AppKinetics storage root location
via resolveLocalFileSystemURL from cordova-plugin-bbd-file
Type:
- string
Example
resolveLocalFileSystemURL(window.plugins.GDAppKineticsPlugin.storageLocation,
function(directoryEntry) {
var appKineticsDirectoryReader = directoryEntry.createReader();
appKineticsDirectoryReader.readEntries(function (entries) {
console.log("AppKinetics storage entries: ", entries);
}, function(error) {
console.log("Error: ", error);
});
}, function(error) {
console.log("resolveLocalFileSystemURL error: ", error)
}
);
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. |
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, attachmentsNativeURL, 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 |
attachmentsNativeURL |
array | Array of attachments native paths (nativeURL), 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. |
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" },
[ "file:///path_to_directory_with_files/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. |
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 from AppKinetics storage.
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. |
Example
window.plugins.GDAppKineticsPlugin.copyFilesToSecureFileSystem(
function(result) {
alert("Number of files copied = " + result);
}
);
getServiceProvidersFor(serviceId, version, onSuccess, onError)
Call this function to get the list of the available service providers of a specified service.
Parameters:
Name | Type | Description |
---|---|---|
serviceId |
string | Identifier of the service |
version |
string | Version of the service |
onSuccess |
function | Callback function to invoke when the function returns successfully. |
onError |
function | Callback function to invoke for error conditions. |
Example
window.plugins.GDAppKineticsPlugin.getServiceProvidersFor("com.good.gdservice.transfer-file", "1.0.0.0",
function(result) {
alert("Received details: " + result);
},
function(result) {
alert("An error occurred while getting the available service providers: " + 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. |
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. |
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. |
Example
window.plugins.GDAppKineticsPlugin.retrieveFiles(
function(result) {
alert("Files retrieved");
},
function(result) {
alert("Retrieve files is failed" + result);
}
);
sendEmailViaBBWork(toRecipients, ccRecipients, bccRecipients, subject, body, attachmentsNativeURL, onSuccess, onError)
Call this function to securely compose email via "BlackBerry Work" that is service provider
for [Send Email Service](https://marketplace.blackberry.com/services/855115) service.
It calls "callAppKineticsService" method with pre-defined parameters - "com.good.gfeservice.send-email" serviceId,
"1.0.0.0" version and "sendEmail" method.
Parameters:
Name | Type | Description |
---|---|---|
toRecipients |
array | Array of strings representing email addresses that will go into "TO" field of the email in BlackBerry Work |
ccRecipients |
array | Array of strings representing email addresses that will go into "CC" field of the email in BlackBerry Work |
bccRecipients |
array | Array of strings representing email addresses that will go into "BCC" field of the email in BlackBerry Work |
subject |
string | String representing "Subject" field of the email in BlackBerry Work |
body |
string | String representing "Body" of the email in BlackBerry Work |
attachmentsNativeURL |
array | Array of strings containing the paths of files in the BlackBerry Dynamics secure file system that will be added to "Attachments" field of the email in BlackBerry Work |
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. |
Example
window.plugins.GDAppKineticsPlugin.sendEmailViaBBWork(
["to@example.com"],
["cc1@example.com", "cc2@example.com"],
[],
"Test subject",
"Test body",
["file:///Inbox/data/testfile.doc"],
function(result) {
alert("Email data is successfully sent to Blackberry Work!");
},
function(result) {
alert("Failed to send email data to BlackBerry Work, check if BlackBerry Work is installed!");
}
);
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 attachments 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. |
- Deprecated:
- It will be removed in future versions. Use sendEmailViaBBWork function instead.
- 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(nativeURL, applicationId, onSuccess, onError)
Call this function to send file to the app by applicationId.
Parameters:
Name | Type | Description |
---|---|---|
nativeURL |
string | Native path (nativeURL) for 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. |
Example
window.plugins.GDAppKineticsPlugin.sendFileToApp(
"file:///path_to_directory_with_files/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. |
Example
window.plugins.GDAppKineticsPlugin.setReceiveAttachmentsFunction(
function(result) {
alert("Files retrieved");
}
);