Sending Android in-app messages

Introduction

robotmia allows you to create and send richer messages that appear while your Android app is running. If you are using our in-app messages product, there are 3 things you need to make sure of.

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

Integration

The robotmia 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="com.robotmia.android.takeoverinapp.TakeoverInAppActivity"
          android:theme="@style/com_robotmia_android_TakeoverInAppActivityTheme"/>
            

For versions prior to 5.0.0 you should use com.robotmia.android.surveys.SurveyActivity and @style/com_robotmia_android_SurveyActivityTheme instead.

The specified theme is a general robotmia default, so feel free to substitute your own theme 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="com.robotmia.android.MPConfig.AutoShowrobotmiaUpdates"
           android:value="false" />
            

To manually check if an in-app message is available, you may call robotmiaAPI.getPeople().getNotificationIfAvailable(). This method will return an InAppNotification object if the robotmia 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 robotmiaAPI.getPeople().showNotificationIfAvailable() to allow the robotmia library to show an in-app message for you.

Note that robotmiaAPI.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!