public class UserKit
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
alias(java.lang.String aliasProfileID,
OnProfileEditCallback defaultCallback)
Alias profile ID.
|
static UserKit |
getInstance()
* Get
UserKit singleton instance. |
java.lang.String |
getProfileId()
Get current profile ID.
|
ProfileManager |
getProfileManager()
Get
ProfileManager instance. |
boolean |
hasProfile()
Check if current profile ID is null or not.
|
void |
identify(java.lang.String profileId)
Replace current profile ID with new one (in local), all analytic events
and profile updating will use this identified ID.
|
static void |
init(android.content.Context context)
Initialization
UserKit instance, your api token must be placed in AndroidManifest.xml
inside application tag. |
static void |
init(android.content.Context context,
java.lang.String apiToken)
Initialization
UserKit instance with an api token. |
boolean |
postGcmToken(java.lang.String deviceToken)
Register GCM (device) token to CMS synchronously, don't run this method in main thread.
|
void |
timeEvent(java.lang.String eventName)
Start tracking duration of a timing event.
|
void |
track(java.lang.String eventName,
org.json.JSONObject properties)
Tracking event.
|
void |
track(java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> props)
Tracking event.
|
public static UserKit getInstance()
UserKit singleton instance.java.lang.IllegalStateException - if UserKit has not been initialized.public static void init(android.content.Context context)
UserKit instance, your api token must be placed in AndroidManifest.xml
inside application tag.
<meta-data android:name="USER_KIT_API_TOKEN" android:value="your_api_token_here" />
context - application context. init(Context, String)public static void init(android.content.Context context,
java.lang.String apiToken)
UserKit instance with an api token.context - application contextapiToken - userkit api tokenpublic void identify(java.lang.String profileId)
profileId - new profile ID.getProfileId(),
ProfileManager.getProfileId()public ProfileManager getProfileManager()
ProfileManager instance.ProfileManagerpublic boolean hasProfile()
public java.lang.String getProfileId()
@WorkerThread
public boolean postGcmToken(java.lang.String deviceToken)
throws java.io.IOException
OneoffTask
will be scheduled to update token in CMS.deviceToken - GCM token of current device.java.io.IOExceptionpublic void alias(java.lang.String aliasProfileID,
OnProfileEditCallback defaultCallback)
aliasProfileID - alias profile ID.defaultCallback - OnProfileEditCallbackpublic void timeEvent(java.lang.String eventName)
eventName - The event name, must be consistent with argument `eventName` on track(String, JSONObject)public void track(java.lang.String eventName,
java.util.Map<java.lang.String,java.lang.Object> props)
eventName - The event name.props - properties of this event.public void track(java.lang.String eventName,
org.json.JSONObject properties)
eventName - the event name.properties - properties of this event.