Google is committed to advancing racial equity for Black communities. See how.

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

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

For an optimal experience with In-App Messaging, we recommend enabling Google Analytics in your project. Also, as part of setting up Analytics, you need to add the Firebase SDK for Analytics to your app.

Java

implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.7'
implementation 'com.google.firebase:firebase-analytics:17.4.3'

Kotlin+KTX

implementation 'com.google.firebase:firebase-inappmessaging-display-ktx:19.0.7'
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3'

Send a test message

Get your app's installation 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 FirebaseInstallations ID, or FID. Find your testing app's FID by checking the Logcat in Android Studio for the following `Info` level log:

I/FIAM.Headless: Starting InAppMessaging runtime with Installation ID YOUR_INSTALLATION_ID

Send a message to your testing device

Once you've launched your app on the testing device and you have its Firebase installation ID (FID), you can try out Firebase In-App Messaging setup 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 Firebase installation ID in the Add an installation 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