Installation
Install Intercom to see and talk to users of your Android app. Intercom for Android supports API 21 and above.
Note: We recommend using the latest available compileSdkVersion
.
First you’ll need to ensure that the Android Messenger is enabled from inside the Intercom settings panel. When this is disabled, all requests to Intercom will fail.
Step 1 - Install Intercom
If you’re new to Intercom, you’ll need to create an account and start your free trial. 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:14.0.0' implementation 'com.google.firebase:firebase-messaging:23.1.+' }
dependencies { implementation("io.intercom.android:intercom-sdk:14.0.0") implementation("com.google.firebase:firebase-messaging:23.1.+") }
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:14.0.0' }
dependencies { implementation("io.intercom.android:intercom-sdk-base:14.0.0") }
🚧 Important
If you choose this method you won’t be able to send push messages.
Maven central
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"/>
🚧 Transitive Dependencies
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 Github.
Step 2 - Initialize Intercom
First, you'll need to get your Intercom app ID and Android API key. To find these, just select the 'Intercom for Android' option in your app settings.
Then, initialize Intercom by calling the following in the onCreate()
method of your application class:
Intercom.initialize(this, "your api key", "your app id")
Intercom.initialize(this, "your api key", "your app id");
Note: 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") } }
public class CustomApplication extends Application { @Override public void 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>
📘 Important
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.
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.