Android v6 APIs for Mapp Cloud

SDK Versions

The following API calls are available in Android FCM SDK v5.0 and later.

Download the latest Android SDK here: https://developers.mapp.com/#mobile-sdk


Whats New ?


The Android SDK API documentation explains how to perform different operations on a device running your app using the Appoxee SDK.

1. Push Enable/Disable :

Sets whether push notification are to be sent to the device

Code Sample for Push Enable/Disable
Appoxee.instance().setPushEnabled(true);

True if wish to enable push, false if wish to avoid push messages to this device

2. Alias:

An alias is a unique, user-specific identifier, set by the application owner (for example, the user's email or an internal system ID number) and is limited to 254 characters.

Aliases have the following uses:

  • The app owner and CEP console for Mapp Cloud both use the same alias to identify the user.
  • All devices owned by a specific user (an iPhone, an iPad etc.) are identified by the same alias.
  • Aliases are used to create segments of application users, based on user-specific properties (as opposed to application-specific properties).


Note the difference between aliases and tags:

  • Aliases are user-specific, and each user can only have one alias (shared by all the user's devices). 
  • Tags are app-specific, and you can assign multiple tags to the same device. 


 Set Alias: Sets the device alias, replacing the current alias value.

Sample code for set alias
public RequestStatus setAlias(String alias)
 
//use this syntax to set alias
Appoxee.instance().setAlias(alias);


Get Alias: Get the alias value

Sample code for Get Alias
public String getAlias()
 
//use this syntax to get alias
 Appoxee.instance().getAlias();

3. Tags

tag is used to label users with different elements of the app's business logic. 
For example, if your app is intended for pet owners, you can define the different pets as tags ("Dog", "Cat", “Parrot” etc.) and then label users with different tags, depending on the pets they own. 
Tags are a useful way to create Segments: Groups of devices that share the same parameters (in this case, the tag values). 
You can then send Push notifications to the relevant segments (for example, one notification for dog owners and another for cat owners). 

Add Tag:  Add a tag to device

Sample code for Add Tag
public RequestStatus addTag(String tag)
 
//use this syntax to add tag
Appoxee.instance().addTag(tag);


Get Tags: get all tags apply to the device

Sample code for Get Tag
public Set<String> getTags()
 
//use this syntax for getting all tags
 Appoxee.instance().getTags()


Remove Tag: remove tag for device, pass tag into parameter, which you want to remove

Sample code for Remove Tag
public RequestStatus removeTag(String tag){
 
//use this syntax for removing tag 
Appoxee.instance().removeTag(removeTag)

4. Custom Fields: 

In the same way you use tags to mark your users with different business logic information, you can add custom strings, numbers and date variables. The information you set on each user can later be used to segment the users and create personalized dynamic push messages.

For example:

  • Add a user's first name to create personal push messages: " Hi John, we are...."
  • Add a user's birthday and use it to create a periodic birthday campaign to congratulate users on their birthday
  • Add a user's level in the game and use it to segment the users according to the level they have reached in your game

Set Custom Attribute: Set string, numeric & date as attribute. Pass key for attribute name

Sample code for Custom Attribute
public RequestStatus setAttribute(String key, String stringValue)
public RequestStatus setAttribute(String key, Number numericValue)
public RequestStatus setAttribute(String key, Date dateValue)
 
//use this syntax to set custom attribute
Appoxee.instance().setAttribute(key, value)


Get Custom Attribute: pass key, which you use to set attribute


Sample code for Get Custom Attribute
public String getAttributeStringValue(String key)
 
//usse this syntax to get custom attribute
Appoxee.instance().getAttributeStringValue(key)

5. Device Info:

The Device Info API is used to return various device parameters, such as the device Operating System name and number, or the version number of the Appoxee SDK installed on this device.

You can also use the API to set device parameters, for example: increase the number of products purchased through this device.

Sample code for Device Info
public DeviceInfo getDeviceInfo()
 
//use this syntax to get device info
Appoxee.instance().getDeviceInfo() 

6. Log Out

Logs out the current user, pass true/false into a parameter to enable/disable push notification.

For example, if you use false for the second parameter, your user won't receive a push notification until the user logs in again or enable push notification. If you use true for the second parameter, your user will receive a push notification despite being logged out.

Sample code for Log Out
public void logOut(Application application, boolean pushEnable)


//use this syntax to logged out user and disable receiving push notification 
Appoxee.instance().logOut(getApplication(), false);