Android In-App Message


Messaging and Mobile A/B Testing Deprecation

Messaging and mobile A/B testing are not available for purchase and will be deprecated from the product on January 1st, 2022. Read more information on the Mixpanel blog.


In App Messages - Supported Library Versions

In-app messages are supported in Android library versions 4.9.4+.


The Mixpanel Android library automatically checks for messages in the background and will attempt to display them anytime an Activity is displayed. If you only wish to use mini in-app messages, then no extra integration is necessary.

If you wish to use takeover messages, then you must declare TakeoverInAppActivity in your AndroidManifest.xml file.

<activity android:name=""          android:theme="@style/com_mixpanel_android_TakeoverInAppActivityTheme"/>



For versions prior to 5.0.0 you should use and @style/com_mixpanel_android_SurveyActivityTheme instead.

The specified theme is a general Mixpanel default, so feel free to substitute your own theme to better match the look and feel of your application.

Controlling When to Show an In-App Message

You may not want the messages to show everytime a new Activity is displayed. For example, if you have a game and only want to show a message when a user accomplishes a goal, you need to turn off the automatic showing of messages by adding the following option in the <application> section of your AndroidManifest.xml file.

<meta-data android:name=""
           android:value="false" />

To manually check if an in-app message is available, you may call MixpanelAPI.getPeople().getNotificationIfAvailable(). This method will return an InAppNotification object if the Mixpanel library has received an in-app message for the currently identified user, and null otherwise. You may then use this object to render your own in-app message.

You can also call MixpanelAPI.getPeople().showNotificationIfAvailable() to allow the Mixpanel library to show an in-app message for you.

Note that MixpanelAPI.getPeople().showNotificationIfAvailable() will not display a message if there is already a message showing, so it is safe to call this function at any location where you want to potentially display a message

Using Profile Properties

Just like emails, in-app messages will replace content wrapped in {{}}. For example, if you add a Location property to your user profiles, you can send messages like this:

Come and visit us at our {{ ${Location} }} office!

A user with a profile property Location: Asheville will get the following message:

Come and visit us at our Asheville office!

If some of your profiles have a value, but others don't, you can use a fallback value:

Come and visit us at our {{ ${Location} | fallback:"nearest" }} office!

Profiles without a Location property will receive this message:

Come and visit us at our nearest office!

Updated 3 months ago

Android In-App Message

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.