Android In-App Messages

Contents: [ Controlling When to Show an In-App Message , Using Profile Properties ]
[In App Messages - Supported Library Versions , Integration, NOTE ]

Visit the Dev Docs

A better version of this page exists at

Mixpanel enables you to create and send rich in-application messages to users using your mobile application. If you are using our in-app messages product, there are three things you need to make sure of.

  1. Include the latest version of the Mixpanel Android Library in your app.
  2. Make sure you are identifying your users in your app.
  3. Create an in-app message on the Messages tab of the Mixpanel website.

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!
Did this answer your question?



Please sign in to leave a comment.