Get started with Firebase In-App Messaging

This quickstart shows you how to set up Firebase In-App Messaging and send your first message.

Before you begin

If you haven't already, add Firebase to your Android project.

In your project-level build.gradle file, make sure to include Google's Maven repository in both your buildscript and allprojects sections.

Add the Firebase In-App Messaging SDK to your project

Include the SDK in your build files

Add the dependency for the In-App Messaging Android library to your module (app-level) Gradle file (usually app/build.gradle):

dependencies {
    // ...

    // Add the In-App Messaging and Analytics dependencies:
    implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.3'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
}

Send a test message

Get your app's Instance ID

To conserve power, Firebase In-App Messaging only retrieves messages from the server once per day. That can make testing difficult, so the Firebase console allows you to specify a test device that displays messages on demand.

That testing device is determined by a FirebaseInstanceId. Find your testing app's Instance ID by checking the Logcat in Android Studio for the following `Info` level log:

I/FIAM.Headless: Starting InAppMessaging runtime with Instance ID YOUR_APP_ID

Send a message to your testing device

Once you've launched your app on the testing device and you have its Instance ID, you can try out Firebase In-App Messaging set up by sending a test message:

  1. In the Firebase console, open In-App Messaging.
  2. Once there, click New Campaign.
  3. Enter a Title for your first message.
  4. Click Test on your Device
  5. Enter your app's Instance ID in the Add an instance ID field.
  6. Click Test to send the message.

Firebase In-App Messaging sends your test message as soon as you click Test. To see it, close, then reopen the app on your testing device.

To confirm whether your device is a test device, look for the following log message:

I/FIAM.Headless: Setting this device as a test device