public class Apptentive
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Apptentive.AuthenticationFailedListener
A Listener you can register globally for the app, that will be called when requests other than
login fail for the active conversation.
|
static class |
Apptentive.AuthenticationFailedReason
A list of error codes you will encounter when a JWT failure for logged in conversations occurs.
|
static interface |
Apptentive.BooleanCallback
Allows certain Apptentive API methods to execute and return a boolean result asynchronously.
|
static class |
Apptentive.DateTime |
static interface |
Apptentive.LoginCallback
Callback interface login().
|
static interface |
Apptentive.OnPreInteractionListener
Represents a callback which will be invoked right before an interaction is engaged.
|
static interface |
Apptentive.PendingIntentCallback |
static class |
Apptentive.Version
This type represents a semantic version.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INTEGRATION_PUSH_TOKEN
For internal use only.
|
static int |
PUSH_PROVIDER_AMAZON_AWS_SNS
Call
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device through your existing Amazon AWS SNS integration. |
static int |
PUSH_PROVIDER_APPTENTIVE
Call
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device without a third party push provider. |
static int |
PUSH_PROVIDER_PARSE
Call
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device through your existing Parse Push integration. |
static int |
PUSH_PROVIDER_URBAN_AIRSHIP
Call
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device through your existing Urban Airship Push integration. |
| Constructor and Description |
|---|
Apptentive() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addCustomDeviceData(java.lang.String key,
java.lang.Boolean value)
Add a custom data Boolean to the Device.
|
static void |
addCustomDeviceData(java.lang.String key,
java.lang.Number value)
Add a custom data Number to the Device.
|
static void |
addCustomDeviceData(java.lang.String key,
java.lang.String value)
Add a custom data String to the Device.
|
static void |
addCustomPersonData(java.lang.String key,
java.lang.Boolean value)
Add a custom data Boolean to the Person.
|
static void |
addCustomPersonData(java.lang.String key,
java.lang.Number value)
Add a custom data Number to the Person.
|
static void |
addCustomPersonData(java.lang.String key,
java.lang.String value)
Add a custom data String to the Person.
|
static void |
addUnreadMessagesListener(UnreadMessagesListener listener)
Add a listener to be notified when the number of unread messages in the Message Center changes.
|
static void |
buildPendingIntentFromPushNotification(Apptentive.PendingIntentCallback callback,
android.os.Bundle bundle)
Use this method in your push receiver to build a pending Intent when an Apptentive push
notification is received.
|
static void |
buildPendingIntentFromPushNotification(Apptentive.PendingIntentCallback callback,
android.content.Intent intent)
Use this method in your push receiver to build a pending Intent when an Apptentive push
notification is received.
|
static void |
buildPendingIntentFromPushNotification(Apptentive.PendingIntentCallback callback,
java.util.Map<java.lang.String,java.lang.String> data)
Use this method in your push receiver to build a pending Intent when an Apptentive push
notification is received.
|
static void |
canShowMessageCenter(Apptentive.BooleanCallback callback)
Our SDK must connect to our server at least once to download initial configuration for Message
Center.
|
static void |
clearAuthenticationFailedListener() |
static void |
engage(android.content.Context context,
java.lang.String event)
This method takes a unique event string, stores a record of that event having been visited,
determines if there is an interaction that is able to run for this event, and then runs it.
|
static void |
engage(android.content.Context context,
java.lang.String event,
Apptentive.BooleanCallback callback)
This method takes a unique event string, stores a record of that event having been visited,
determines if there is an interaction that is able to run for this event, and then runs it.
|
static void |
engage(android.content.Context context,
java.lang.String event,
Apptentive.BooleanCallback callback,
java.util.Map<java.lang.String,java.lang.Object> customData)
This method takes a unique event string, stores a record of that event having been visited,
determines if there is an interaction that is able to run for this event, and then runs it.
|
static void |
engage(android.content.Context context,
java.lang.String event,
Apptentive.BooleanCallback callback,
java.util.Map<java.lang.String,java.lang.Object> customData,
ExtendedData... extendedData)
This method takes a unique event string, stores a record of that event having been visited,
determines if there is an interaction that is able to run for this event, and then runs it.
|
static void |
engage(android.content.Context context,
java.lang.String event,
java.util.Map<java.lang.String,java.lang.Object> customData)
This method takes a unique event string, stores a record of that event having been visited,
determines if there is an interaction that is able to run for this event, and then runs it.
|
static void |
engage(android.content.Context context,
java.lang.String event,
java.util.Map<java.lang.String,java.lang.Object> customData,
ExtendedData... extendedData)
This method takes a unique event string, stores a record of that event having been visited,
determines if there is an interaction that is able to run for this event, and then runs it.
|
static java.lang.String |
getBodyFromApptentivePush(android.os.Bundle bundle)
Use this method in your push receiver to get the notification body text you can use to
construct a
Notification object. |
static java.lang.String |
getBodyFromApptentivePush(android.content.Intent intent)
Use this method in your push receiver to get the notification body text you can use to
construct a
Notification object. |
static java.lang.String |
getBodyFromApptentivePush(java.util.Map<java.lang.String,java.lang.String> data)
Use this method in your push receiver to get the notification body text you can use to
construct a
Notification object. |
static java.lang.String |
getPersonEmail()
Retrieves the user's email address.
|
static java.lang.String |
getPersonName()
Retrieves the user's name.
|
static java.lang.String |
getTitleFromApptentivePush(android.os.Bundle bundle)
Use this method in your push receiver to get the notification title you can use to construct a
Notification object. |
static java.lang.String |
getTitleFromApptentivePush(android.content.Intent intent)
Use this method in your push receiver to get the notification title you can use to construct a
Notification object. |
static java.lang.String |
getTitleFromApptentivePush(java.util.Map<java.lang.String,java.lang.String> data)
Use this method in your push receiver to get the notification title you can use to construct a
Notification object. |
static int |
getUnreadMessageCount()
Returns the number of unread messages in the Message Center.
|
static boolean |
isApptentivePushNotification(android.os.Bundle bundle)
Determines whether this Bundle came from an Apptentive push notification.
|
static boolean |
isApptentivePushNotification(android.content.Intent intent)
Determines whether this Intent is a push notification sent from Apptentive.
|
static boolean |
isApptentivePushNotification(java.util.Map<java.lang.String,java.lang.String> data)
Determines whether push payload data came from an Apptentive push notification.
|
static void |
login(java.lang.String token,
Apptentive.LoginCallback callback)
Starts login process asynchronously.
|
static void |
logout() |
static void |
onApptimizeExperimentRun(java.lang.String experimentName,
java.lang.String variantName,
boolean firstRun)
Invoke this method from your Apptimize.OnExperimentRunListener when an A/B experiment is run.
|
static void |
onApptimizeExperimentsProcessed()
Invoke this method from your Apptimize.OnExperimentsProcessedListener when A/B experiment configuration is recalculated..
|
static void |
putRatingProviderArg(java.lang.String key,
java.lang.String value)
If there are any properties that your
IRatingProvider implementation requires, populate them here. |
static void |
queryCanShowInteraction(java.lang.String event,
Apptentive.BooleanCallback callback)
This method can be used to determine if a call to one of the
engage() methods such as
engage(Context, String) using the same event name will
result in the display of an Interaction. |
static void |
register(android.app.Application application)
Deprecated.
Please, use
register(Application, String, String) or register(Application, ApptentiveConfiguration) instead |
static void |
register(android.app.Application application,
ApptentiveConfiguration configuration)
Must be called from the
Application.onCreate() method in the Application object defined in your app's manifest. |
static void |
register(android.app.Application application,
java.lang.String apptentiveKey,
java.lang.String apptentiveSignature)
Must be called from the
Application.onCreate() method in the Application object defined in your app's manifest. |
static void |
registerCallbacks(android.app.Application application)
Register application callbacks.
|
static void |
removeCustomDeviceData(java.lang.String key)
Remove a piece of custom data from the device.
|
static void |
removeCustomPersonData(java.lang.String key)
Remove a piece of custom data from the Person.
|
static void |
sendAttachmentFile(byte[] content,
java.lang.String mimeType)
Sends a file to the server.
|
static void |
sendAttachmentFile(java.io.InputStream is,
java.lang.String mimeType)
Sends a file to the server.
|
static void |
sendAttachmentFile(java.lang.String uri)
Sends a file to the server.
|
static void |
sendAttachmentText(java.lang.String text)
Sends a text message to the server.
|
static void |
setAuthenticationFailedListener(Apptentive.AuthenticationFailedListener listener)
Registers your listener with Apptentive.
|
static void |
setOnPreInteractionListener(Apptentive.OnPreInteractionListener onPreInteractionListener)
Sets an optional engagement callback.
|
static void |
setOnSurveyFinishedListener(OnSurveyFinishedListener listener)
Pass in a listener.
|
static void |
setPersonEmail(java.lang.String email)
Sets the user's email address.
|
static void |
setPersonName(java.lang.String name)
Sets the user's name.
|
static void |
setPushNotificationIntegration(int pushProvider,
java.lang.String token)
Sends push provider information to our server to allow us to send pushes to this device when
you reply to your customers.
|
static void |
setRatingProvider(IRatingProvider ratingProvider)
Use this to choose where to send the user when they are prompted to rate the app.
|
static void |
setUnreadMessagesListener(UnreadMessagesListener listener)
Deprecated.
|
static void |
showMessageCenter(android.content.Context context)
Opens the Apptentive Message Center UI Activity.
|
static void |
showMessageCenter(android.content.Context context,
Apptentive.BooleanCallback callback)
Opens the Apptentive Message Center UI Activity.
|
static void |
showMessageCenter(android.content.Context context,
Apptentive.BooleanCallback callback,
java.util.Map<java.lang.String,java.lang.Object> customData)
Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the
next message the user sends.
|
static void |
showMessageCenter(android.content.Context context,
java.util.Map<java.lang.String,java.lang.Object> customData)
Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the
next message the user sends.
|
public static final java.lang.String INTEGRATION_PUSH_TOKEN
public static final int PUSH_PROVIDER_APPTENTIVE
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device without a third party push provider. Requires a valid GCM configuration.public static final int PUSH_PROVIDER_PARSE
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device through your existing Parse Push integration. Requires a valid Parse integration.public static final int PUSH_PROVIDER_URBAN_AIRSHIP
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device through your existing Urban Airship Push integration. Requires a valid Urban
Airship Push integration.public static final int PUSH_PROVIDER_AMAZON_AWS_SNS
setPushNotificationIntegration(int, String) with this value to allow Apptentive to send pushes
to this device through your existing Amazon AWS SNS integration. Requires a valid Amazon AWS SNS
integration.@Deprecated public static void register(android.app.Application application)
register(Application, String, String) or register(Application, ApptentiveConfiguration) insteadApplication.onCreate() method in the Application object defined in your app's manifest.
Note: application key and signature would be resolved from the AndroidManifest.xmlapplication - The Application object for this app.public static void register(android.app.Application application,
java.lang.String apptentiveKey,
java.lang.String apptentiveSignature)
Application.onCreate() method in the Application object defined in your app's manifest.application - Application object.apptentiveKey - Apptentive Key.apptentiveSignature - Apptentive Signature.public static void register(android.app.Application application,
ApptentiveConfiguration configuration)
Application.onCreate() method in the Application object defined in your app's manifest.application - Application object.configuration - Apptentive configuration containing SDK initialization data.public static void registerCallbacks(android.app.Application application)
public static void setPersonEmail(java.lang.String email)
getPersonEmail() before you call this method.email - The user's email address.public static java.lang.String getPersonEmail()
setPersonEmail(String),
or by the user through Message Center.public static void setPersonName(java.lang.String name)
getPersonName() before you call this method.name - The user's name.public static java.lang.String getPersonName()
setPersonName(String),
or by the user through Message Center.public static void addCustomDeviceData(java.lang.String key,
java.lang.String value)
key - The key to store the data under.value - A String value.public static void addCustomDeviceData(java.lang.String key,
java.lang.Number value)
key - The key to store the data under.value - A Number value.public static void addCustomDeviceData(java.lang.String key,
java.lang.Boolean value)
key - The key to store the data under.value - A Boolean value.public static void removeCustomDeviceData(java.lang.String key)
key - The key to remove.public static void addCustomPersonData(java.lang.String key,
java.lang.String value)
key - The key to store the data under.value - A String value.public static void addCustomPersonData(java.lang.String key,
java.lang.Number value)
key - The key to store the data under.value - A Number value.public static void addCustomPersonData(java.lang.String key,
java.lang.Boolean value)
key - The key to store the data under.value - A Boolean value.public static void removeCustomPersonData(java.lang.String key)
key - The key to remove.public static void setPushNotificationIntegration(int pushProvider,
java.lang.String token)
pushProvider - One of the following:
token - The push provider token you receive from your push provider. The format is push provider specific.
public static boolean isApptentivePushNotification(android.content.Intent intent)
intent - The received Intent you received in your BroadcastReceiver.public static boolean isApptentivePushNotification(android.os.Bundle bundle)
bundle - The push payload bundle passed to GCM onMessageReceived() callbackpublic static boolean isApptentivePushNotification(java.util.Map<java.lang.String,java.lang.String> data)
data - The push payload data obtained through FCM's RemoteMessage.getData(), when using FCMpublic static void buildPendingIntentFromPushNotification(@NonNull
Apptentive.PendingIntentCallback callback,
@NonNull
android.content.Intent intent)
Use this method in your push receiver to build a pending Intent when an Apptentive push
notification is received. Pass the generated PendingIntent to
NotificationCompat.Builder.setContentIntent(android.app.PendingIntent) to allow Apptentive
to display Interactions such as Message Center. Calling this method for a push Intent that did
not come from Apptentive will return a null object. If you receive a null object, your app will
need to handle this notification itself.
This task is performed asynchronously.
This is the method you will likely need if you integrated using:
callback - Called after we check to see Apptentive can launch an Interaction from this
push. Called with a PendingIntent to launch an Apptentive Interaction
if the push data came from Apptentive, and an Interaction can be shown, or
null.intent - An Intent containing the Apptentive Push data. Pass in what you receive
in the Service or BroadcastReceiver that is used by your chosen push provider.public static void buildPendingIntentFromPushNotification(@NonNull
Apptentive.PendingIntentCallback callback,
@NonNull
android.os.Bundle bundle)
Use this method in your push receiver to build a pending Intent when an Apptentive push
notification is received. Pass the generated PendingIntent to
NotificationCompat.Builder.setContentIntent(android.app.PendingIntent) to allow Apptentive
to display Interactions such as Message Center. Calling this method for a push Bundle that
did not come from Apptentive will return a null object. If you receive a null object, your app
will need to handle this notification itself.
This task is performed asynchronously.
This is the method you will likely need if you integrated using:
callback - Called after we check to see Apptentive can launch an Interaction from this
push. Called with a PendingIntent to launch an Apptentive Interaction
if the push data came from Apptentive, and an Interaction can be shown, or
null.bundle - A Bundle containing the Apptentive Push data. Pass in what you receive in
the the Service or BroadcastReceiver that is used by your chosen push provider.public static void buildPendingIntentFromPushNotification(Apptentive.PendingIntentCallback callback, @NonNull java.util.Map<java.lang.String,java.lang.String> data)
Use this method in your push receiver to build a pending Intent when an Apptentive push
notification is received. Pass the generated PendingIntent to
NotificationCompat.Builder.setContentIntent(android.app.PendingIntent) to allow Apptentive
to display Interactions such as Message Center. Calling this method for a push Bundle that
did not come from Apptentive will return a null object. If you receive a null object, your app
will need to handle this notification itself.
This task is performed asynchronously.
This is the method you will likely need if you integrated using:
callback - Called after we check to see Apptentive can launch an Interaction from this
push. Called with a PendingIntent to launch an Apptentive Interaction
if the push data came from Apptentive, and an Interaction can be shown, or
null.data - A Map<String,String> containing the Apptentive
Push data. Pass in what you receive in the the Service or BroadcastReceiver
that is used by your chosen push provider.public static java.lang.String getTitleFromApptentivePush(android.content.Intent intent)
Notification object.intent - An Intent containing the Apptentive Push data. Pass in what you receive
in the Service or BroadcastReceiver that is used by your chosen push provider.public static java.lang.String getBodyFromApptentivePush(android.content.Intent intent)
Notification object.intent - An Intent containing the Apptentive Push data. Pass in what you receive
in the Service or BroadcastReceiver that is used by your chosen push provider.public static java.lang.String getTitleFromApptentivePush(android.os.Bundle bundle)
Notification object.bundle - A Bundle containing the Apptentive Push data. Pass in what you receive in
the the Service or BroadcastReceiver that is used by your chosen push provider.public static java.lang.String getBodyFromApptentivePush(android.os.Bundle bundle)
Notification object.bundle - A Bundle containing the Apptentive Push data. Pass in what you receive in
the the Service or BroadcastReceiver that is used by your chosen push provider.public static java.lang.String getTitleFromApptentivePush(java.util.Map<java.lang.String,java.lang.String> data)
Notification object.data - A Map<String,String> containing the Apptentive Push
data. Pass in what you receive in the the Service or BroadcastReceiver that is
used by your chosen push provider.public static java.lang.String getBodyFromApptentivePush(java.util.Map<java.lang.String,java.lang.String> data)
Notification object.data - A Map<String,String> containing the Apptentive Push
data. Pass in what you receive in the the Service or BroadcastReceiver that is
used by your chosen push provider.public static void setRatingProvider(IRatingProvider ratingProvider)
ratingProvider - A IRatingProvider value.public static void putRatingProviderArg(java.lang.String key,
java.lang.String value)
IRatingProvider implementation requires, populate them here. This
is not currently needed with the Google Play and Amazon Appstore IRatingProviders.key - A Stringvalue - A Stringpublic static void showMessageCenter(android.content.Context context)
showMessageCenter(Context, BooleanCallback).context - The context from which to launch the Message Centerpublic static void showMessageCenter(android.content.Context context,
Apptentive.BooleanCallback callback)
context - The context from which to launch the Message Centercallback - Called after we check to see if Message Center can be displayed, but before it
is displayed. Called with true if an Interaction will be displayed, else false.public static void showMessageCenter(android.content.Context context,
java.util.Map<java.lang.String,java.lang.Object> customData)
showMessageCenter(Context, BooleanCallback, Map).context - The context from which to launch the Message Center. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Message Center will launch in a new task.customData - A Map of String keys to Object values. Objects may be Strings, Numbers, or Booleans.
If any message is sent by the Person, this data is sent with it, and then
cleared. If no message is sent, this data is discarded.public static void showMessageCenter(android.content.Context context,
Apptentive.BooleanCallback callback,
java.util.Map<java.lang.String,java.lang.Object> customData)
context - The context from which to launch the Message Center. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Message Center will launch in a new task.callback - Called after we check to see if Message Center can be displayed, but before
it is displayed. Called with true if an Interaction will be displayed, else
false.customData - A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. If any message is sent by the Person, this data is sent with it,
and then cleared. If no message is sent, this data is discarded.public static void canShowMessageCenter(Apptentive.BooleanCallback callback)
callback - Called after we check to see if Message Center can be displayed, but before it
is displayed. Called with true if an Interaction will be displayed, else false.@Deprecated public static void setUnreadMessagesListener(UnreadMessagesListener listener)
addUnreadMessagesListener(UnreadMessagesListener) instead.listener - An UnreadMessagesListener that you instantiate. Pass null to remove existing listener.
Do not pass in an anonymous class, such as setUnreadMessagesListener(new UnreadMessagesListener() {...}).
Instead, create your listener as an instance variable and pass that in. This
allows us to keep a weak reference to avoid memory leaks.public static void addUnreadMessagesListener(UnreadMessagesListener listener)
listener - An UnreadMessagesListener that you instantiate. Do not pass in an anonymous class.
Instead, create your listener as an instance variable and pass that in. This
allows us to keep a weak reference to avoid memory leaks.public static int getUnreadMessageCount()
public static void sendAttachmentText(java.lang.String text)
text - The message you wish to send.public static void sendAttachmentFile(java.lang.String uri)
uri - The URI of the local resource file.public static void sendAttachmentFile(byte[] content,
java.lang.String mimeType)
content - A byte array of the file contents.mimeType - The mime type of the file.public static void sendAttachmentFile(java.io.InputStream is,
java.lang.String mimeType)
is - An InputStream from the desired file.mimeType - The mime type of the file.public static void engage(android.content.Context context,
java.lang.String event)
engage(Context, String, BooleanCallback)context - The context from which to launch the Interaction. This should be an Activity,
except in rare cases where you don't have access to one, in which case
Apptentive Interactions will launch in a new task.event - A unique String representing the line this method is called on. For instance,
you may want to have the ability to target interactions to run after the user
uploads a file in your app. You may then call
engage(context, "finished_upload");public static void engage(android.content.Context context,
java.lang.String event,
Apptentive.BooleanCallback callback)
context - The context from which to launch the Interaction. This should be an Activity,
except in rare cases where you don't have access to one, in which case
Apptentive Interactions will launch in a new task.event - A unique String representing the line this method is called on. For instance,
you may want to have the ability to target interactions to run after the user
uploads a file in your app. You may then call
engage(context, "finished_upload");callback - Called after we check to see if an Interaction should be displayed. Called with
true if an Interaction will be displayed, else false.public static void engage(android.content.Context context,
java.lang.String event,
java.util.Map<java.lang.String,java.lang.Object> customData)
engage(Context, String, BooleanCallback, Map).context - The context from which to launch the Interaction. This should be an Activity,
except in rare cases where you don't have access to one, in which case
Apptentive Interactions will launch in a new task.event - A unique String representing the line this method is called on. For instance,
you may want to have the ability to target interactions to run after the user
uploads a file in your app. You may then call
engage(context, "finished_upload");customData - A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. This data is sent to the server for tracking information in the
context of the engaged Event.public static void engage(android.content.Context context,
java.lang.String event,
Apptentive.BooleanCallback callback,
java.util.Map<java.lang.String,java.lang.Object> customData)
context - The context from which to launch the Interaction. This should be an Activity,
except in rare cases where you don't have access to one, in which case
Apptentive Interactions will launch in a new task.event - A unique String representing the line this method is called on. For instance,
you may want to have the ability to target interactions to run after the user
uploads a file in your app. You may then call
engage(context, "finished_upload");callback - Called after we check to see if an Interaction should be displayed. Called with
true if an Interaction will be displayed, else false.customData - A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. This data is sent to the server for tracking information in the
context of the engaged Event.public static void engage(android.content.Context context,
java.lang.String event,
java.util.Map<java.lang.String,java.lang.Object> customData,
ExtendedData... extendedData)
engage(Context, String, BooleanCallback, Map, ExtendedData...).context - The context from which to launch the Interaction. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Interactions will launch in a new task.event - A unique String representing the line this method is called on.
For instance, you may want to have the ability to target interactions to
run after the user uploads a file in your app. You may then call
engage(context, "finished_upload");customData - A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. This data is sent to the server for tracking information in the
context of the engaged Event.extendedData - An array of ExtendedData objects. ExtendedData objects used to send
structured data that has specific meaning to the server. By using an
ExtendedData object instead of arbitrary customData, special
meaning can be derived. Supported objects include TimeExtendedData,
LocationExtendedData, and CommerceExtendedData. Include
each type only once.public static void engage(android.content.Context context,
java.lang.String event,
Apptentive.BooleanCallback callback,
java.util.Map<java.lang.String,java.lang.Object> customData,
ExtendedData... extendedData)
context - The context from which to launch the Interaction. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Interactions will launch in a new task.event - A unique String representing the line this method is called on.
For instance, you may want to have the ability to target interactions to
run after the user uploads a file in your app. You may then call
engage(context, "finished_upload");callback - Called after we check to see if an Interaction should be displayed. Called with
true if an Interaction will be displayed, else false.customData - A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. This data is sent to the server for tracking information in the
context of the engaged Event.extendedData - An array of ExtendedData objects. ExtendedData objects used to send
structured data that has specific meaning to the server. By using an
ExtendedData object instead of arbitrary customData, special
meaning can be derived. Supported objects include TimeExtendedData,
LocationExtendedData, and CommerceExtendedData. Include
each type only once.public static void queryCanShowInteraction(java.lang.String event,
Apptentive.BooleanCallback callback)
engage() methods such as
engage(Context, String) using the same event name will
result in the display of an Interaction. This is useful if you need to know whether an Interaction will be
displayed before you create a UI Button, etc.event - A unique String representing the line this method is called on. For instance, you may want to have
the ability to target interactions to run after the user uploads a file in your app. You may then
call engage(activity, "finished_upload");public static void setOnPreInteractionListener(@Nullable
Apptentive.OnPreInteractionListener onPreInteractionListener)
public static void setOnSurveyFinishedListener(OnSurveyFinishedListener listener)
listener - The OnSurveyFinishedListener listener
to call when the survey is finished.public static void login(java.lang.String token,
Apptentive.LoginCallback callback)
token - A JWT signed by your server using the secret from your app's Apptentive settings.callback - A LoginCallback, which will be called asynchronously when the login succeeds
or fails.public static void logout()
public static void setAuthenticationFailedListener(Apptentive.AuthenticationFailedListener listener)
This listener will alert you to authentication failures, so that you can either recover from expired or revoked JWTs, or fix your authentication implementation.
listener - A listener that will be called when there is an authentication failure other
for the current logged in conversation. If the failure is for another
conversation, or there is no active conversation, the listener is not called.public static void clearAuthenticationFailedListener()
public static void onApptimizeExperimentRun(java.lang.String experimentName,
java.lang.String variantName,
boolean firstRun)
public static void onApptimizeExperimentsProcessed()