Adobe Air Bridge API (Mapp Cloud)
Initializing the plugin
Construct the AppoxeeANE in your application's constructor.
Use your Appoxee Key & Secret as shown in the application's screen on the Appoxee Dashboard.
SDK Key & Secret - Do Not Mix Platforms!
Make sure the Key & Secret under your iOS Application in the Appoxee Dashboard is used for your iOS Air App.
Make sure the Key & Secret under your Android Application in the Appoxee Dashboard is used for your Android Air App.
Do not mix between them!
Engage
import com.appoxee.AppoxeeANE;
...
private var _appoxeeANE:AppoxeeANE;
...
public function YourAirApp() {
super();
...
_appoxeeANE = new AppoxeeANE(key, secret,handleIncomingPushMessage);
}
...
private function handleIncomingPushMessage(payload:String):void {
trace("Handle Incoming Push Message Called with : "+result);
//handle push payload in callback
}
...
Push Notification Callback and Extra Fields Parsing
The method handleIncomingPushMessage() id the method that will be called every time a push notification will be received by the device. Further explanation on using the Incoming Push Notification Callback Method can be found in Appoxee Adobe Air - Handling Extra Fields.
Alias
Set device alias.
/**
* Set device's alias - a unique identifier tor this device
* @param value alias
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function setDeviceAlias(value:String,func:Function):void
Example
private function handleSetAliasCallback(result:String):void {
//Do something with result (true/false as string)
}
...
function setDeviceAlias(alias:String):void {
_appoxeeANE.setDeviceAlias(alias,handleSetAliasCallback);
}
Get device alias.
/**
* Get device's alias
* @param func callback function to get result (expected : the alias , Empty String (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function getDeviceAlias(func:Function):void
Example
private function getAliasCallback(result:String):void {
//Do something with result (the alias itself)
}
...
function getAlias():void {
_appoxeeANE.getDeviceAlias(getAliasCallback);
}
Remove Alias
/**
* Remove device's alias
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function removeDeviceAlias(func:Function):void
Example
private function handleRemoveAliasCallback(result:String):void {
//Do something with result (true/false as string)
}
function removeDeviceAlias():void {
_appoxeeANE.removeDeviceAlias(handleRemoveAliasCallback);
}
Device API
Device Information
/**
* Get device info, as stored on Appoxee servers
* @param func callback function to get result (expected : json payload as string contains the device's info)
*/
public function getDeviceInformation(func:Function):void
Example
private function getDeviceInfoCallback(result:String):void {
//Result is Device Info
}
function deviceInformation():void {
_appoxeeANE.getDeviceInformation(getDeviceInfoCallback);
}
Inbox API
Inbox / In-App messages / Rich Messages API is not supported in Android
Rich Messages
Available only for Appoxee standalone customers (Not available for DMC customers)
/**
* Get the list of messages [note: not available for Android]
* @param func callback function to get result (expected : json payload as string , representing the rich messages)
*/
public function getRichMessages(func:Function):void
Example
private function handleGetRichMessagesCallback(result:String):void {
//Result is string representation of the rich messages
}
...
function getRichMessages():void {
_appoxeeANE.getRichMessages(handleGetRichMessagesCallback);
}
Delete Messages
/**
* Delete inbox message [note: not available for Android]
* @param messageID id of the message to delete
* @param func callback function to get result (expected : "true" when the operation is successful)
*/
public function deleteRichMessage(messageId:int,func:Function):void
Example
private function handleDeleteMessageCallback(result:String):void {
//Do something with the result
}
function deleteRichMessage(msgID:int):void {
_appoxeeANE.deleteRichMessage(msgID,handleDeleteMessageCallback);
}
Refresh Inbox
/**
* Reload inbox messages [note: not available for Android]
* @param func callback function to get result
*/
public function refreshInbox(func:Function):void
Example
private function handleRefreshInboxCallback(result:String):void {
//Do something with the result
}
...
function refreshInbox():void {
_appoxeeANE.refreshInbox(handleRefreshInboxCallback);
}
Disable Inbox
/**
* Enable/disable inbox messages [note: not available for Android]
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function setInboxEnabled(value:Boolean,func:Function):void
Example
private function setInboxCallback(result:String):void {
//To something with the result
}
...
function toggleInbox(value:Boolean):void {
_appoxeeANE.setInboxEnabled(value,setInboxCallback);
}
Inbox Enabled
/**
* Return if inbox is enabled on the device [note: not available for Android]
* @return true/false (is the Inbox Enabled or Disabled)
*/
public function isInboxEnabled():Boolean
Example
function isInboxEnabled():Boolean{
_appoxeeANE.isInboxEnabled();
}
Tags API
Tags are not available for DMC customers yet (coming soon)
Remove Tags
/**
* Remove a tag to device, must be one which is listed on app tags (see getApplicationTags())
* @param removeTag tag to add (set false)
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function removeTagFromDevice(removeTag:String,func:Function):void
Example
private function handleRemoveTagCallback(result:String):void {
}
...
function removeTagsFromDevice(tag:String):void {
_appoxeeANE.removeTagFromDevice(tag,handleRemoveTagCallback);
}
Add Tag
/**
* Add a tag to device, must be one which is listed on app tags (see getApplicationTags())
* @param setTag tag to add (set true)
* @param func callback function to get result (expected : "true" when the operation is successful , Empty Result (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function addTagToDevice(setTag:String,func:Function):void
Example
private function handleSetTagCallback(result:String):void {
}
...
function addTagsToDevice(tag:String):void {
_appoxeeANE.addTagToDevice(tag,handleSetTagCallback);
}
Get Device Tags
/**
* Get device tags - a list current device tags
* @param func callback function to get result (expected : The Device's Tags, when the operation is successful , Empty Result (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function getDeviceTags(func:Function):void
Example
private function getDeviceTagsCallback(result:String):void {
//Result is device tags
}
function fetchDeviceTags():void {
_appoxeeANE.getDeviceTags(getDeviceTagsCallback);
}
Application Tags
/**
* Get application tags - a list of tags supported by your app configuration on dashboard
* @param func callback function to get result (expected : The Application's Tags, when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function getApplicationTags(func:Function):void
Example
private function getAppTagsCallback(result:String):void {
//Result is application tags
}
...
function fetchApplicationTags():void {
_appoxeeANE.getApplicationTags(getAppTagsCallback);
}
Push API
Push Enabled
/**
* Return if push are enabled on the device
* @return true/false (Is Push Enabled or Disabled)
*/
public function isPushEnabled():Boolean
Example
function isPushEnabled():Boolean {
return _appoxeeANE.isPushEnabled();
}
Enable Push
/**
* Enable/disable push messages (soft opt-out)
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function setPushEnabled(value:Boolean,func:Function):void
Example
private function setPushCallback(result:String):void {
//result is true/false is operation is successful
}
...
function setPushEnabled(value:Boolean):void {
_appoxeeANE.setPushEnabled(value,setPushCallback);
}
Custom Fields API
Set Date Field
/**
* Set value to a Date custom field
* @param name custom-field name
* @param value value to set
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function setDateCustomField(name:String,value:Date,func:Function):void
Example
private function setDateCustomFieldCallback(result:String):void {
//result is true/false is operation is successful
}
function setDateNowField(key:String) {
_appoxeeANE.setDateCustomField(key,new Date(),setDateCustomFieldCallback);
}
Set Numeric Filed
/**
* Set a value to a numeric custom field
* @param name custom-field name
* @param value value to set
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function setNumericCustomField(name:String,value:Number,func:Function):void
Example
private function setNumericCustomFieldCallback(result:String):void {
//result is true/false is operation is successful
}
function setNumericField(key:String,value:Number) {
_appoxeeANE.setNumericCustomField(key,value,setNumericCustomFieldCallback);
}
Increment Numeric Field
/**
* Incerement a custom numeric field value [note: not available for Android]
* @param name custom-field name
* @param value amount to add
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function incNumericCustomField(name:String,value:Number,func:Function):void
Example
private function getCustomFieldAfterIncCallback(result:String):void {
//Do something with result
}
function incrementNumericField(key:String,value:Number) {
_appoxeeANE.incNumericCustomField(key,value,incNumericCustomFieldCallback);
}
Set String Field
/**
* Set value to a String custom field
* @param name custom-field name
* @param value value to set
* @param func callback function to get result (expected : "true" when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function setStringCustomField(name:String,value:String,func:Function):void
Example
private function setStringCustomFieldCallback(result:String):void {
//result is true/false is operation is successful
}
function setStringField(key:String,value:String) {
_appoxeeANE.setStringCustomField(key,value,setStringCustomFieldCallback);
}
Get Custom Field
/**
* Get custom field value, string representation
* @param name custom-field name
* @param func callback function to get result (expected : the value of the field as string, when the operation is successful , "false" (in Android) or NSError as String (in iOS) if operation has failed)
*/
public function getCustomField(key:String,func:Function):void
Example
private function getCustomFieldCallback(result:String):void {
//Result is the returned value, as string
}
function fetchCustomFieldByKey(key:String) {
_appoxeeANE.getCustomField(key,getCustomFieldCallback);
}
iOS10 ONLY
Show Foreground Notifications / Get Foreground Notifications state
Example
function showOrHideForegroundNotificationOnIos10(key:Boolean) {
_appoxeeANE.setShowForegroundNotifications(key,setShowNotificationsCallback);
}
private function setShowNotificationsCallback(result:String):void {
var res:Boolean = _appoxeeANE.getShowForegroundNotifications();
//Result is the returned value, as string
}