Installation
Install Intercom to see and talk to users of your Android app. Intercom for Android supports API 21 and above.
We recommend using the latest available compileSdkVersion
.
Step 1 - Install Intercom
If you’re new to Intercom, you’ll need to create an account and start your free trial.
Go to your settings and under Installation select install for mobile.
Then choose Android.
Next, enable user traffic for Messenger.
You must ensure that the Android Messenger is enabled from inside the Intercom settings panel. When this is disabled, all requests to Intercom will fail.
Then you have two options:
Option 1: Install Intercom with Push Messaging
Add the following dependency to your app's build.gradle
file:
dependencies {
implementation 'io.intercom.android:intercom-sdk:latest.release'
implementation 'com.google.firebase:firebase-messaging:23.1.+'
}
Instead of latest.release
, it is best practice to replace it with the latest version number. You can get our latest Intercom Android SDK version from here.
Option 2: Install Intercom without Push Messaging
If you'd rather not have push notifications in your app, you can use this dependency:
dependencies {
implementation 'io.intercom.android:intercom-sdk-base:latest.release'
}
dependencies {
implementation("io.intercom.android:intercom-sdk-base:latest.release")
}
Maven central
If you choose this method you won’t be able to send push messages.
Intercom is hosted on maven central. You will need to add maven central to your root build.gradle file.
allprojects {
repositories {
mavenCentral()
}
}
Permissions
We include the INTERNET permission by default as we need it to make network requests:
<uses-permission android:name="android.permission.INTERNET"/>
You will need to include the READ_EXTERNAL_STORAGE permission if you have enabled image attachments:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
You can also include VIBRATE to enable vibration in push notifications:
<uses-permission android:name="android.permission.VIBRATE"/>
As of version 9.0.0, Intercom Android SDK transitively depends on the latest versions of Gson, Otto, Okio, Okhttp and Retrofit. If your app is using any one of these libraries, they should at least be on the same major version that the Intercom SDK is using. When there are two versions of a library at build time, Gradle automatically picks the newer version. This means if you are currently using Retrofit 2.4.0, you would automatically get Retrofit 2.9.0 after including Intercom.
For the exact version numbers we are using, please check the dependency graph on Maven Central.
Step 2 - Initialize Intercom
Initialize Intercom by calling the following in the onCreate()
method of your application class:
Intercom.initialize(this, "your api key", "your app id")
If you don't currently implement a custom application, you’ll need to create one. A custom application looks like this:
class CustomApplication : Application() {
override fun onCreate() {
super.onCreate()
Intercom.initialize(this, "your api key", "your app id")
}
}
You’ll need to update your manifest to use your application:
<application
android:name=".CustomApplication">
</application>
Intercom must be initialized inside the application onCreate()
method. Initializing anywhere else will result in Intercom not behaving as expected and could even result in the host app crashing.
You can also manage your API Keys during this step.
Step 3 — Check the Installation
You can check to see if your installation was successful. If the Messenger has been found for your chosen installation you will receive a success notification, otherwise or you will be notified that something has gone wrong.
What next?
Once you've installed Intercom you can start using Intercom in your Android app.
- Configure it for your Android app.
- Enable push notifications so you can send push messages.
- Enable Identity Verification for your Android app.