public class IterableApi
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
clearInboxSessionId() |
void |
disablePush()
Disables the device from push notifications
|
protected void |
disableToken(java.lang.String email,
java.lang.String userId,
java.lang.String token) |
protected void |
disableToken(java.lang.String email,
java.lang.String userId,
java.lang.String authToken,
java.lang.String deviceToken,
IterableHelper.SuccessHandler onSuccess,
IterableHelper.FailureHandler onFailure)
Internal api call made from IterablePushRegistration after a registrationToken is obtained.
|
static void |
getAndTrackDeeplink(java.lang.String uri,
IterableHelper.IterableActionHandler onCallback)
Tracks a click on the uri if it is an iterable link.
|
IterableAttributionInfo |
getAttributionInfo()
Returns the attribution information (
IterableAttributionInfo) for last push open
or app link click from an email. |
IterableInAppManager |
getInAppManager()
Returns an
IterableInAppManager that can be used to manage in-app messages. |
static IterableApi |
getInstance()
Get
IterableApi singleton instance |
android.os.Bundle |
getPayloadData()
Retrieves all of the payload as a single Bundle Object
|
java.lang.String |
getPayloadData(java.lang.String key)
Retrieves the payload string for a given key.
|
static boolean |
handleAppLink(java.lang.String uri)
Handles an App Link
For Iterable links, it will track the click and retrieve the original URL, pass it to
IterableUrlHandler for handling
If it's not an Iterable link, it just passes the same URL to IterableUrlHandler
Call this from Activity.onCreate(Bundle) and Activity.onNewIntent(Intent)
in your deep link handler activity |
void |
inAppConsume(IterableInAppMessage message,
IterableInAppDeleteActionType source,
IterableInAppLocation clickLocation)
Tracks InApp delete.
|
void |
inAppConsume(java.lang.String messageId)
Consumes an InApp message.
|
static void |
initialize(android.content.Context context,
java.lang.String apiKey)
Initializes IterableApi
This method must be called from
Application.onCreate()
Note: Make sure you also call setEmail(String) or setUserId(String) before calling other methods |
static void |
initialize(android.content.Context context,
java.lang.String apiKey,
IterableConfig config)
Initializes IterableApi
This method must be called from
Application.onCreate()
Note: Make sure you also call setEmail(String) or setUserId(String) before calling other methods |
boolean |
isIterableIntent(android.content.Intent intent)
Returns whether or not the intent was sent from Iterable.
|
static void |
overrideURLEndpointPath(java.lang.String url)
Debugging function to send API calls to different url endpoints.
|
void |
registerDeviceToken(java.lang.String deviceToken)
Registers a device token with Iterable.
|
protected void |
registerDeviceToken(java.lang.String email,
java.lang.String userId,
java.lang.String authToken,
java.lang.String applicationName,
java.lang.String deviceToken,
java.util.HashMap<java.lang.String,java.lang.String> deviceAttributes) |
protected void |
registerDeviceToken(java.lang.String email,
java.lang.String userId,
java.lang.String authToken,
java.lang.String applicationName,
java.lang.String deviceToken,
org.json.JSONObject dataFields,
java.util.HashMap<java.lang.String,java.lang.String> deviceAttributes)
Registers the GCM registration ID with Iterable.
|
void |
registerForPush()
Registers for push notifications.
|
void |
removeDeviceAttribute(java.lang.String key) |
void |
setDeviceAttribute(java.lang.String key,
java.lang.String value) |
void |
setEmail(java.lang.String email)
Set user email used for API calls
Calling this or
setUserId(String) is required before making any API calls. |
void |
setInboxSessionId(java.lang.String inboxSessionId) |
void |
setNotificationIcon(java.lang.String iconName)
Sets the icon to be displayed in notifications.
|
void |
setUserId(java.lang.String userId)
Set user ID used for API calls
Calling this or
setEmail(String) is required before making any API calls. |
void |
track(java.lang.String eventName)
Track an event.
|
void |
track(java.lang.String eventName,
int campaignId,
int templateId)
Track an event.
|
void |
track(java.lang.String eventName,
int campaignId,
int templateId,
org.json.JSONObject dataFields)
Track an event.
|
void |
track(java.lang.String eventName,
org.json.JSONObject dataFields)
Track an event.
|
void |
trackInAppClick(IterableInAppMessage message,
java.lang.String clickedUrl,
IterableInAppLocation clickLocation)
Tracks an InApp click.
|
void |
trackInAppClick(java.lang.String messageId,
java.lang.String clickedUrl)
Tracks an InApp click.
|
void |
trackInAppOpen(IterableInAppMessage message,
IterableInAppLocation location)
Tracks an in-app open.
|
void |
trackInAppOpen(java.lang.String messageId)
Tracks an in-app open.
|
void |
trackInboxSession(IterableInboxSession session) |
void |
trackPurchase(double total,
java.util.List<CommerceItem> items)
Tracks a purchase.
|
void |
trackPurchase(double total,
java.util.List<CommerceItem> items,
org.json.JSONObject dataFields)
Tracks a purchase.
|
protected void |
trackPushOpen(int campaignId,
int templateId,
java.lang.String messageId) |
protected void |
trackPushOpen(int campaignId,
int templateId,
java.lang.String messageId,
org.json.JSONObject dataFields)
Tracks when a push notification is opened on device.
|
void |
updateEmail(java.lang.String newEmail)
Updates the current user's email.
|
void |
updateEmail(java.lang.String newEmail,
IterableHelper.SuccessHandler successHandler,
IterableHelper.FailureHandler failureHandler)
Updates the current user's email.
|
void |
updateSubscriptions(java.lang.Integer[] emailListIds,
java.lang.Integer[] unsubscribedChannelIds,
java.lang.Integer[] unsubscribedMessageTypeIds)
Updates the user subscription preferences.
|
void |
updateSubscriptions(java.lang.Integer[] emailListIds,
java.lang.Integer[] unsubscribedChannelIds,
java.lang.Integer[] unsubscribedMessageTypeIds,
java.lang.Integer[] subscribedMessageTypeIDs,
java.lang.Integer campaignId,
java.lang.Integer templateId) |
void |
updateUser(org.json.JSONObject dataFields)
Updates the current user.
|
void |
updateUser(org.json.JSONObject dataFields,
java.lang.Boolean mergeNestedObjects)
Updates the current user.
|
public void setNotificationIcon(@Nullable
java.lang.String iconName)
iconName - @Nullable
public java.lang.String getPayloadData(@NonNull
java.lang.String key)
key - @Nullable public android.os.Bundle getPayloadData()
@NonNull public IterableInAppManager getInAppManager()
IterableInAppManager that can be used to manage in-app messages.
Make sure the Iterable API is initialized before calling this method.IterableInAppManager instance@Nullable public IterableAttributionInfo getAttributionInfo()
IterableAttributionInfo) for last push open
or app link click from an email.IterableAttributionInfo Object containingpublic void setDeviceAttribute(java.lang.String key,
java.lang.String value)
public void removeDeviceAttribute(java.lang.String key)
@NonNull public static IterableApi getInstance()
IterableApi singleton instanceIterableApi singleton instancepublic static void initialize(@NonNull
android.content.Context context,
@NonNull
java.lang.String apiKey)
Application.onCreate()
Note: Make sure you also call setEmail(String) or setUserId(String) before calling other methodscontext - Application contextapiKey - Iterable Mobile API keypublic static void initialize(@NonNull
android.content.Context context,
@NonNull
java.lang.String apiKey,
@Nullable
IterableConfig config)
Application.onCreate()
Note: Make sure you also call setEmail(String) or setUserId(String) before calling other methodscontext - Application contextapiKey - Iterable Mobile API keyconfig - IterableConfig object holding SDK configuration optionspublic void setEmail(@Nullable
java.lang.String email)
setUserId(String) is required before making any API calls.
Note: This clears userId and persists the user email so you only need to call this once when the user logs in.email - User emailpublic void setUserId(@Nullable
java.lang.String userId)
setEmail(String) is required before making any API calls.
Note: This clears user email and persists the user ID so you only need to call this once when the user logs in.userId - User IDpublic static void getAndTrackDeeplink(@NonNull
java.lang.String uri,
@NonNull
IterableHelper.IterableActionHandler onCallback)
uri - theonCallback - Calls the callback handler with the destination location
or the original url if it is not an Iterable link.public static boolean handleAppLink(@NonNull
java.lang.String uri)
IterableUrlHandler for handling
If it's not an Iterable link, it just passes the same URL to IterableUrlHandler
Call this from Activity.onCreate(Bundle) and Activity.onNewIntent(Intent)
in your deep link handler activityuri - the URL obtained from Intent.getData() in your deep link
handler activitypublic static void overrideURLEndpointPath(@NonNull
java.lang.String url)
url - public boolean isIterableIntent(@Nullable
android.content.Intent intent)
public void registerDeviceToken(@NonNull
java.lang.String deviceToken)
IterableConfig.pushIntegrationName is set before calling this.deviceToken - Push token obtained from GCM or FCMprotected void registerDeviceToken(@Nullable
java.lang.String email,
@Nullable
java.lang.String userId,
@Nullable
java.lang.String authToken,
@NonNull
java.lang.String applicationName,
@NonNull
java.lang.String deviceToken,
java.util.HashMap<java.lang.String,java.lang.String> deviceAttributes)
public void track(@NonNull
java.lang.String eventName)
eventName - public void track(@NonNull
java.lang.String eventName,
@Nullable
org.json.JSONObject dataFields)
eventName - dataFields - public void track(@NonNull
java.lang.String eventName,
int campaignId,
int templateId)
eventName - campaignId - templateId - public void track(@NonNull
java.lang.String eventName,
int campaignId,
int templateId,
@Nullable
org.json.JSONObject dataFields)
eventName - campaignId - templateId - dataFields - public void trackPurchase(double total,
@NonNull
java.util.List<CommerceItem> items)
total - total purchase amountitems - list of purchased itemspublic void trackPurchase(double total,
@NonNull
java.util.List<CommerceItem> items,
@Nullable
org.json.JSONObject dataFields)
total - total purchase amountitems - list of purchased itemsdataFields - a `JSONObject` containing any additional information to save along with the eventpublic void updateEmail(@NonNull
java.lang.String newEmail)
newEmail - New emailpublic void updateEmail(@NonNull
java.lang.String newEmail,
@Nullable
IterableHelper.SuccessHandler successHandler,
@Nullable
IterableHelper.FailureHandler failureHandler)
newEmail - New emailsuccessHandler - Success handler. Called when the server returns a success code.failureHandler - Failure handler. Called when the server call failed.public void updateUser(@NonNull
org.json.JSONObject dataFields)
dataFields - public void updateUser(@NonNull
org.json.JSONObject dataFields,
java.lang.Boolean mergeNestedObjects)
dataFields - mergeNestedObjects - public void registerForPush()
IterableConfig.pushIntegrationName defined, and
user email or user ID is set before calling this method.public void disablePush()
public void updateSubscriptions(@Nullable
java.lang.Integer[] emailListIds,
@Nullable
java.lang.Integer[] unsubscribedChannelIds,
@Nullable
java.lang.Integer[] unsubscribedMessageTypeIds)
emailListIds - unsubscribedChannelIds - unsubscribedMessageTypeIds - public void updateSubscriptions(@Nullable
java.lang.Integer[] emailListIds,
@Nullable
java.lang.Integer[] unsubscribedChannelIds,
@Nullable
java.lang.Integer[] unsubscribedMessageTypeIds,
@Nullable
java.lang.Integer[] subscribedMessageTypeIDs,
java.lang.Integer campaignId,
java.lang.Integer templateId)
public void trackInAppOpen(@NonNull
java.lang.String messageId)
messageId - public void trackInAppOpen(@NonNull
IterableInAppMessage message,
@NonNull
IterableInAppLocation location)
message - in-app messagepublic void trackInAppClick(@NonNull
java.lang.String messageId,
@NonNull
java.lang.String clickedUrl)
messageId - clickedUrl - public void trackInAppClick(@NonNull
IterableInAppMessage message,
@NonNull
java.lang.String clickedUrl,
@NonNull
IterableInAppLocation clickLocation)
message - in-app messageclickedUrl - public void inAppConsume(@NonNull
java.lang.String messageId)
messageId - public void inAppConsume(@NonNull
IterableInAppMessage message,
@Nullable
IterableInAppDeleteActionType source,
@Nullable
IterableInAppLocation clickLocation)
message - message objectsource - An enum describing how the in App delete was triggeredclickLocation - The module in which the action happenedpublic void trackInboxSession(@NonNull
IterableInboxSession session)
protected void trackPushOpen(int campaignId,
int templateId,
@NonNull
java.lang.String messageId)
protected void trackPushOpen(int campaignId,
int templateId,
@NonNull
java.lang.String messageId,
@Nullable
org.json.JSONObject dataFields)
campaignId - templateId - protected void disableToken(@Nullable
java.lang.String email,
@Nullable
java.lang.String userId,
@NonNull
java.lang.String token)
protected void disableToken(@Nullable
java.lang.String email,
@Nullable
java.lang.String userId,
@Nullable
java.lang.String authToken,
@NonNull
java.lang.String deviceToken,
@Nullable
IterableHelper.SuccessHandler onSuccess,
@Nullable
IterableHelper.FailureHandler onFailure)
email - User email for whom to disable the device.userId - User ID for whom to disable the device.authToken - deviceToken - The device tokenprotected void registerDeviceToken(@Nullable
java.lang.String email,
@Nullable
java.lang.String userId,
@Nullable
java.lang.String authToken,
@NonNull
java.lang.String applicationName,
@NonNull
java.lang.String deviceToken,
@Nullable
org.json.JSONObject dataFields,
java.util.HashMap<java.lang.String,java.lang.String> deviceAttributes)
authToken - applicationName - deviceToken - dataFields - public void setInboxSessionId(@Nullable
java.lang.String inboxSessionId)
public void clearInboxSessionId()