Tags are not available for DMC customers yet (coming soon) |
A 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).
The Tag API enables you to perform actions on tags, both on the application level and on the device level:
All the Tag API methods are callable through Appoxee.methodName, since they are all public static methods.
Before using tags in your code, you must first list all tags required by your application on the Appoxee website, Using unlisted tags in your code during runtime will throw an exception!
|
Since Appoxee.setup() is an Asynchronous Initialisation method, any set action can be performed only after the call Appoxee.isReady()==True. Only after Appoxee.Setup() finished, the flag is set to TRUE value. It is recommended to check the flag before calling setters. |
Using Tags API Methods must be done under AsyncTask. For example :
new AsyncTask<Void, Void, Void>() { ArrayList<String> deviceTags; @Override protected void onPreExecute() { //Do what you need before executing, Progress Bar init etc. } @Override protected Void doInBackground(Void... params) { // get all tags allTags = Appoxee.getTagList(); Utils.Debug("Got Application Tag List = " + allTags); deviceTags = Appoxee.getDeviceTags(); Utils.Debug("Got Device Tag List = " + deviceTags); if (allTags == null) allTags = new ArrayList<String>(); if (deviceTags == null) deviceTags = new ArrayList<String>(); return null; } @Override protected void onPostExecute(Void result) { //Do What you need with the Data, Dismiss Progress Bar etc. } }.execute(); |
Adds the specified tags to the device.
public static boolean addTagsToDevice(ArrayList<String> tags) |
ArrayList – a string array of tags to be added to the device.
true if the specified tags were added successfully; false otherwise.
Removes the specified tags from the device.
public static boolean removeTagsFromDevice(ArrayList<String> tags) |
ArrayList – a string array of tags to be removed from the device.
true if the specified tags were removed successfully; false otherwise.
Gets the current device tag list from the server.
public static ArrayList<String> getDeviceTags() |
ArrayList – a string array of device tags to be returned from the server.
true if the device’s tag list is returned successfully from the server; false if the operation failed.
If the device has no tags, the returned array has 0 elements.
Gets the application's tag list from server.
The application's tag list is the global list of tags defined on the Appoxee website. In order to use the Tag API in the app, this method must be called at least once (usually as part of the registration process).
Call this method in the following cases:
The application tag list cannot be changed locally and tags cannot be added to it via code. |
public static ArrayList<String> getTagList() |
ArrayList – a string array of the application tags to be returned from the server.
true if the application’s tag list is returned successfully from the server; false otherwise.
If no application tag list was defined on the Appoxee website before the coding process, the returned array will be empty.
Clears the local list of device tags from the device cache (the global application tag list cannot be deleted).
public static boolean cleanTagCache() |
true if the local list of device tags was successfully deleted from the device cache; false otherwise.