Cordova bridge API calls
Engaging the plugin
Call this method as soon as possible in your app initialization procces in order to register the device and recieve push.
Method is required to be called on every app launch.
Notification methods (pushMessageReceived, richMessageReceived) we only be available after calling this method.
@param {string} sdkID - The SDK ID for your account.
@param {string} appSecret - The App Secret for you account.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.engage = function(sdkID, appSecret, successCallback, errorCallback) {}
function engage() { AppoxeePlugin.engage("sdk.id", "app.secret", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Check if the device is registered in Appoxee
Returns "true" if registration is completed, "false" if failed or not completed yet.
AppoxeePlugin.prototype.isReady = function (successCallback, errorCallback)
Alias
Set device alias
@param {string} alias - A String to be identified as as the device alias
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.setDeviceAlias = function(alias, successCallback, errorCallback) {}
function setDeviceAlias() { AppoxeePlugin.setDeviceAlias("Phonegap Alias", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Get device alias
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.getAlias = function (successCallback, errorCallback) {}
function getAlias() { AppoxeePlugin.getAlias(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Remove alias
Remove the alias associated with this device.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.removeDeviceAlias = function (successCallback, errorCallback) {}
function removeDeviceAlias() { AppoxeePlugin.removeDeviceAlias(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Device API
Device Information
Get information assoiciated with this device.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.deviceInformation = function (successCallback, errorCallback) {}
function deviceInformation() { AppoxeePlugin.deviceInformation(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Inbox API
Available only for Appoxee standalone customers (Not available for DMC customers)
Rich Messages
Get rich messages for this device.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.getRichMessages = function (successCallback, errorCallback) {}
function getRichMessages() { AppoxeePlugin.getRichMessages(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Delete Messages
Delete a Rich Message.
@param {string} msgID - A string representing the message ID.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.deleteRichMessage = function (msgID, successCallback, errorCallback) {}
function deleteRichMessage() { AppoxeePlugin.deleteRichMessage("0", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Refresh Inbox
Sync inbox messages with Appoxee Servers.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.refreshInbox = function (successCallback, errorCallback) {}
function refreshInbox() { AppoxeePlugin.refreshInbox(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Disable Inbox
Disable / enable the inbox feature.
@param {string} disable - a string with a value of "true" or "false".
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.disableInbox = function (disable, successCallback, errorCallback) {}
function disableInbox() { AppoxeePlugin.disableInbox("true", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Inbox Enabled
Get if inbox feature is enabled.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.isInboxEnabled = function (successCallback, errorCallback) {}
function isInboxEnabled() { AppoxeePlugin.isInboxEnabled(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Tags API
Tags are not available for DMC customers yet (coming soon)
Add And Remove Tags
Add and remove tags from device.
@param {Array} toAdd - An array of Strings ,that represent tags, to be added.
@param {Array} toRemove - An array of Strings, that represents tags, to be removed.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.addTagsToDeviceAndRemove = function (toAdd, toRemove, successCallback, errorCallback) {}
function addTagsToDeviceAndRemove() { AppoxeePlugin.addTagsToDeviceAndRemove(["Tag1", "Tag2"], /* will be added */ ["Tag3", "Tag4"], /* will be removed */ function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Remove Tags
Remove a tag from device.
@param {Array} toRemove - An array of Strings ,that represent tags, to be removed.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.removeTagsFromDevice = function (toRemove, successCallback, errorCallback) {}
function removeTagsFromDevice() { AppoxeePlugin.removeTagsFromDevice(["Tag1", "Tag2"], function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Add Tag
Add a tag to device.
@param {Array} toAdd - An array of Strings ,that represent tags, to be added.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.addTagsToDevice = function (toAdd, successCallback, errorCallback) {}
function addTagsToDevice() { AppoxeePlugin.addTagsToDevice(["Tag1", "Tag2"], function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Device Tags
Get tags which are 'ON' for this device.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.fetchDeviceTags = function (successCallback, errorCallback) {}
function fetchDeviceTags() { AppoxeePlugin.fetchDeviceTags(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Application Tags
Get the application tags defined at Appoxee. Note that only 'application tags' can be added as 'device tags'.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.fetchApplicationTags = function (successCallback, errorCallback) {}
function fetchApplicationTags() { AppoxeePlugin.fetchApplicationTags(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Push API
Push Enabled
Get if the feature is enabled.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.isPushEnabled = function (successCallback, errorCallback) {}
function isPushEnabled() { AppoxeePlugin.isPushEnabled(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Disable Push
Method will disable / enable the feature.
@param {string} disable - a string with a value of "true" or "false".
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.disablePushNotifications = function (disable, successCallback, errorCallback) {}
function disablePushNotifications() { AppoxeePlugin.disablePushNotifications("true", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Custom Fields API
Set Date Field
Set a date value for a key.
@param {string} key - A key to be paired with the value.
@param {string} value - A value which conforms 'yyyy-MM-dd hh:mm:ss'.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.setDateField = function (key, value, successCallback, errorCallback) {}
function setDateField() { AppoxeePlugin.setDateField("myDateKey", "2015-03-16 00:00:00", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Set Numeric Field
Set a number value for a key.
@param {string} key - A key to be paired with the value.
@param {string} value - A value which contains a number, i.e. "34", "34.54".
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.setNumericField = function (key, value, successCallback, errorCallback) {}
function setNumericField() { AppoxeePlugin.setNumericField("myNumericKey", "2133", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Set String Field
Set a string value for a key.
@param {string} key - A key to be paired with the value.
@param {string} value - A value which contains string.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.setStringField = function (key, value, successCallback, errorCallback) {}
function setStringField() { AppoxeePlugin.setStringField("myStringKey", "some string value", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Get Custom Field
Get a key-value pair for a givven key.
@param {string} key - A key paired with a value.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.fetchCustomFieldByKey = function (key, successCallback, errorCallback) {}
function fetchCustomFieldByKey() { AppoxeePlugin.fetchCustomFieldByKey("myStringKey", function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Notifications
Get Last Push
Get last push payload. Method will only return the payload once.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.getLastPushPayload = function (successCallback, errorCallback) {}
function getLastPushPayload() { AppoxeePlugin.getLastPushPayload(function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Badge Number (iOS Only)
Method sets the application badge number on iOS only, and only if notifications are approved.
@param {string} badgeNumber - a string with a value of an Integer, to set as the application badge number.
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.setApplicationBadgeNumber = function (badgeNumber, successCallback, errorCallback){}
function setApplicationBadgeToZero() { AppoxeePlugin.setApplicationBadgeNumber("0", // Pass the Badge number you want the application icon to present. function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Show Notifications on Foreground (iOS10 Only)
Method will show / hide notification when app is in foreground. Default is false. Available for ios10 and above.
@param {string} show - a string with a value of "true" or "false".
@callback {string} successCallback - A json string with a response for this operation with information.
@callback {string} errorCallback - A json string with a response for this operation with information.
AppoxeePlugin.prototype.showNotificationsOnForeground = function (show, successCallback, errorCallback){}
function showNotificationOnForeground() { AppoxeePlugin.showNotificationsOnForeground("true", // Pass 'true' or 'false' to indicate if notifications should be displayed on foreground. function (json) { alert(JSON.stringify(json)); }, function (json) { alert(JSON.stringify(json)); }); }
Rich Received (iOS Only)
Method is called when a rich message is received.
@param {string} jsonArg - A json string with the rich message payload.
AppoxeePlugin.prototype.richMessageReceived = function richMessageReceived(jsonArg) {}
AppoxeePlugin.prototype.richMessageReceived = function richMessageReceived(jsonArg) { alert("Rich Message:\n" + jsonArg); /* Add your own implementation here. */ }