Android

The Android experimental API guide

Our Android Messenger currently offers an experimental API. We use experimental Intercom to test changes to our public API. We appreciate any feedback on your experience with our trial API. You can contact us using our messenger at http://intercom.com.

How to use the experimental API

To use the experimental API, first make sure you are including at minimum version 4.1.1 of the Android SDK compile 'io.intercom.android:intercom-sdk:4.1.1'. Any class that included import io.intercom.android.sdk.Intercom should be changed to import io.intercom.android.sdk.experimental.Intercom;

Change Intercom.initialize

First you will want to go to where you call Intercom.initialize(Application, ApiKey, AppId) This method needed to be called from a custom Application class. It would prepare the state of Intercom but required a subsequent call to either Intercom.client().registerUnidentifiedUser() or Intercom.client().registerIdentifiedUser(registration) before you could successfully use the messenger.

The new API uses a method called Intercom.boot(Application, IntercomSettings). Unlike initialize, boot does not need to be called in a custom Application class. It also results in the creation/logging in of a user. The IntercomSettings object requires an API key and an App ID. It will automatically create/login an unidentified mobile user unless you provide a user ID and or email in which case it will create/login an identified user.

🚧

Intercom.boot always creates/logging in of a user

As a result of boot always creating/logging in a user it is strongly advised moving the boot method out of the Application class. It is possible for the application class to be hit while your app is backgrounded which would result in an Intercom network request and inflating the users session count.

Change registerUnidentifiedUser and registerIdentifiedUser

The methods registerUnidentifiedUser() and registerIdentifiedUser(Registration) are removed. Calling boot now registers a user.
To migrate from an unidentified to an identified user you can simply call updateUser(UserAttributes) where the UserAttributes object contains a userId and/or email. You can still call updateUser as it was in previous versions to modify standard and custom attributes.

Change reset or logout

To logout a user call the Intercom.client().shutdown() method. To communicate with Intercom again you need to call the boot method again.