The new Intercom Messenger feels native in your mobile app and works seamlessly across platforms. Here’s how to install it on Android, localize your language, decide how the launcher appears for your users and more.
1. Upgrade to the new Messenger (for everyone)
In your 'build.gradle' file change the version of the Intercom library to '3.+' so that it looks like this:
That’s it - you’ve successfully migrated to the new Messenger.
2. Update your app’s code (if needed)
We’ve updated a number of features to improve the Messenger and make it easier to integrate. If you use any of these features, you'll need to update the following methods:
GCM is now easier to integrate. If you’ve enabled push notifications, you’ll need to:
openGCMMessage(Uri data) to
openGcmMessage()We now store the data URI so you don’t need to provide us with it.
2. We set up GCM for you now, so you don’t need to call
setUpGCM(String regid, int appLogo). Instead, just add your sender id to res/values/strings.xml like this:
3. Instead of getting your app logo from `
setUpGCM(String regid, int appLogo) just add an image to resources called intercom_push_icon.png. Make sure to place this in all of your densities, eg. hdpi xhdpi.
Hiding the Messenger
Now you can hide individual elements of the Messenger. Instead of calling
setVisibility(int visibility)you’ll need to hide each element individually, like this:
- To hide the launcher call
- To hide in-app messages call
- To hide the Messenger call
Chat preview position
Previously you could set the position of in-app message previews with
setPreviewPositionWe've removed this so you’ll need to remove it from your code too.
Choose how the launcher appears for your users (new features)
Now you’ll have a bunch of new options for customizing, showing and opening the launcher. You can:
Show the standard launcher
If you’d like the standard launcher to appear on the bottom right of your screen, just call:
Open the custom launcher in the best location for users
If you have a custom launcher, you can call Intercom.client().displayMessenger(); and we’ll ensure the Messenger opens in the best place for each user. For example:
- If a user has one unread conversation, we open that conversation.
- If a user has no conversations, we open the composer.
- If a user has more than one unread conversation, we open the conversations list.
- If a user has no unread conversations, we open the last screen they were on when they closed it.
Show your user’s unread message count
Now you can show how many unread conversations your user has on your custom launcher. Even if a user dismisses a notification, they’ll still have a persistent indicator of unread conversations.
Just grab the current count with this method:
Then, start listening for updates using: