Package 

Object Apptentive

  • All Implemented Interfaces:

    
    public class Apptentive
    
                        
    • Constructor Detail

    • Method Detail

      • engage

        @JvmOverloads() final static Unit engage(String eventName, Map<String, Object> customData, EngagementCallback callback)

        This method takes a unique event of type 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. Only one interaction at most will run per invocation of this method. This task is performed asynchronously.

        Parameters:
        eventName - A unique String representing the line this method is called on.
        customData - Extra data sent with the engaged event.
        callback - Returns EngagementCallback of an EngagementResult.
      • engage

        @JvmOverloads() final static Unit engage(String eventName, Map<String, Object> customData)

        This method takes a unique event of type 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. Only one interaction at most will run per invocation of this method. This task is performed asynchronously.

        Parameters:
        eventName - A unique String representing the line this method is called on.
        customData - Extra data sent with the engaged event.
      • engage

        @JvmOverloads() final static Unit engage(String eventName)

        This method takes a unique event of type 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. Only one interaction at most will run per invocation of this method. This task is performed asynchronously.

        Parameters:
        eventName - A unique String representing the line this method is called on.
      • showMessageCenter

        @JvmOverloads() final static Unit showMessageCenter(Map<String, Object> customData)

        Opens the Apptentive Message Center. This operation is performed asynchronously.

        Parameters:
        customData - Extra data sent with messages in Message Center.
      • canShowMessageCenter

         final static Unit canShowMessageCenter(BooleanCallback callback)

        Our SDK must connect to our server at least once to download initial configuration for Message Center. Call this method to see whether or not Message Center can be displayed. This task is performed asynchronously.

        Parameters:
        callback - Called after we check to see if Message Center can be displayed, but before it is displayed.
      • getUnreadMessageCount

         final static Integer getUnreadMessageCount()

        Returns the number of unread messages in the Message Center.

        This should be called after Apptentive is started. If this is called before Apptentive finishes initializing for the first time then it may not work.

      • sendAttachmentText

         final static Unit sendAttachmentText(String text)

        Sends a text message to the server. This message will be visible in the conversation view on the server, but will not be shown in the client's Message Center.

        Parameters:
        text - The message you wish to send.
      • sendAttachmentFile

         final static Unit sendAttachmentFile(String uri)

        Sends a file to the server. This file will be visible in the conversation view on the server, but will not be shown in the client's Message Center. A local copy of this file will be made until the message is transmitted, at which point the temporary file will be deleted.

        NOTICE: FILE SIZE LIMIT IS 15MB

        Parameters:
        uri - The URI path of the local resource file.
      • sendAttachmentFile

         final static Unit sendAttachmentFile(ByteArray content, String mimeType)

        Sends a file to the server. This file will be visible in the conversation view on the server, but will not be shown in the client's Message Center. A local copy of this file will be made until the message is transmitted, at which point the temporary file will be deleted.

        NOTICE: FILE SIZE LIMIT IS 15MB

        Parameters:
        content - A byte array of the file contents.
        mimeType - The mime type of the file.
      • sendAttachmentFile

         final static Unit sendAttachmentFile(InputStream inputStream, String mimeType)

        Sends a file to the server. This file will be visible in the conversation view on the server, but will not be shown in the client's Message Center. A local copy of this file will be made until the message is transmitted, at which point the temporary file will be deleted.

        NOTICE: FILE SIZE LIMIT IS 15MB

        Parameters:
        inputStream - An InputStream from the desired file.
        mimeType - The mime type of the file.
      • setPersonName

         final static Unit setPersonName(String name)

        Sets the user's name. This name will be sent to the Apptentive server and displayed in conversations you have with this person. This name will be the definitive username for this user, unless one is provided directly by the user through an Apptentive UI. Calls to this method are idempotent. Calls to this method will overwrite any previously entered person's name. You can check the value with getPersonName.

        null or blank strings will fail to be set on the server so we don't attempt.

        Parameters:
        name - The user's name.
      • setPersonEmail

         final static Unit setPersonEmail(String email)

        Sets the user's email address. This email address will be sent to the Apptentive server to allow out of app communication, and to help provide more context about this user. This email will be the definitive email address for this user, unless one is provided directly by the user through an Apptentive UI. Calls to this method are idempotent. Calls to this method will overwrite any previously entered email, so if you don't want to overwrite any previously entered email. You can check the value with getPersonEmail.

        null or blank strings will fail to be set on the server so we don't attempt.

        Parameters:
        email - The user's email address.
      • getPersonEmail

         final static String getPersonEmail()

        Retrieves the user's email address. This address may be set via setPersonEmail, or by the user through Message Center.

      • addCustomPersonData

         final static Unit addCustomPersonData(String key, String value)

        Add a custom data String to the Person. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent.

        Parameters:
        key - The key to store the data under.
        value - A String value.
      • addCustomPersonData

         final static Unit addCustomPersonData(String key, Number value)

        Add a custom data Number to the Person. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent.

        Parameters:
        key - The key to store the data under.
        value - A Number value.
      • addCustomPersonData

         final static Unit addCustomPersonData(String key, Boolean value)

        Add a custom data Boolean to the Person. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent.

        Parameters:
        key - The key to store the data under.
        value - A Boolean value.
      • removeCustomPersonData

         final static Unit removeCustomPersonData(String key)

        Remove a piece of custom data from the Person. Calls to this method are idempotent.

        Parameters:
        key - The key to remove.
      • setMParticleId

         final static Unit setMParticleId(String id)

        Sets the mParticleId of the user. It is used to associate a MParticle user with a conversation in Apptentive dashboard

        Parameters:
        id - The mParticleId of the person.
      • addCustomDeviceData

         final static Unit addCustomDeviceData(String key, String value)

        Add a custom data String to the Device. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent.

        Parameters:
        key - The key to store the data under.
        value - A String value.
      • addCustomDeviceData

         final static Unit addCustomDeviceData(String key, Number value)

        Add a custom data Number to the Device. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent.

        Parameters:
        key - The key to store the data under.
        value - A Number value.
      • addCustomDeviceData

         final static Unit addCustomDeviceData(String key, Boolean value)

        Add a custom data Boolean to the Device. Custom data will be sent to the server, is displayed in the Conversation view, and can be used in Interaction targeting. Calls to this method are idempotent.

        Parameters:
        key - The key to store the data under.
        value - A Boolean value.
      • removeCustomDeviceData

         final static Unit removeCustomDeviceData(String key)

        Remove a piece of custom data from the device. Calls to this method are idempotent.

        Parameters:
        key - The key to remove.
      • isApptentivePushNotification

         final Boolean isApptentivePushNotification(Intent intent)

        Determines whether this Intent is a push notification sent from Apptentive.

        Parameters:
        intent - The received Intent you received in your BroadcastReceiver.
      • isApptentivePushNotification

         final Boolean isApptentivePushNotification(Map<String, String> data)

        Determines whether push payload data came from an Apptentive Push Notification. This method is also used for Urban Airship.

        Parameters:
        data - The push payload data obtained through FCM onMessageReceived(), when using FCM
      • buildPendingIntentFromPushNotification

         final Unit buildPendingIntentFromPushNotification(Context context, PendingIntentCallback callback, Intent intent)

        Use this method in your push receiver to build a PendingIntent when an Apptentive push notification is received. Pass the generated PendingIntent to androidx.core.app.NotificationCompat.Builder.setContentIntent 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 Urban Airship, AWS/SNS, or Parse

        Parameters:
        callback - Called after we check to see Apptentive can launch an Interaction from this push.
        intent - An Intent containing the Apptentive Push data.
      • buildPendingIntentFromPushNotification

         final Unit buildPendingIntentFromPushNotification(Context context, PendingIntentCallback callback, Map<String, 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 androidx.core.app.NotificationCompat.Builder.setContentIntent 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 Firebase Cloud Messaging or Urban Airship

        Parameters:
        callback - Called after we check to see Apptentive can launch an Interaction from this push.
        data - A Map<String, String>; containing the Apptentive Push data.
      • getAPPTENTIVE_NOTIFICATION_ID

         final Integer getAPPTENTIVE_NOTIFICATION_ID()

        Use this ID when you call notify for Apptentive Push Notifications if you want notifications to be cleared when when Message Center is shown.