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.

Add the Firebase In-App Messaging SDK to your project

In your module (app-level) Gradle file (usually <project>/<app-module>/build.gradle.kts or <project>/<app-module>/build.gradle), add the dependency for the In-App Messaging library for Android. We recommend using the Firebase Android BoM to control library versioning.

To use In-App Messaging, you must enable Google Analytics in your Firebase project and add the Firebase SDK for Google Analytics to your app.

dependencies {
    // Import the BoM for the Firebase platform
    implementation(platform("com.google.firebase:firebase-bom:33.6.0"))

    // Add the dependencies for the In-App Messaging and Analytics libraries
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation("com.google.firebase:firebase-inappmessaging-display")
    implementation("com.google.firebase:firebase-analytics")
}

By using the Firebase Android BoM, your app will always use compatible versions of Firebase Android libraries.

(Alternative)  Add Firebase library dependencies without using the BoM

If you choose not to use the Firebase BoM, you must specify each Firebase library version in its dependency line.

Note that if you use multiple Firebase libraries in your app, we strongly recommend using the BoM to manage library versions, which ensures that all versions are compatible.

dependencies {
    // Add the dependencies for the In-App Messaging and Analytics libraries
    // When NOT using the BoM, you must specify versions in Firebase library dependencies
    implementation("com.google.firebase:firebase-inappmessaging-display:21.0.1")
    implementation("com.google.firebase:firebase-analytics:22.1.2")
}
Looking for a Kotlin-specific library module? Starting in October 2023 (Firebase BoM 32.5.0), both Kotlin and Java developers can depend on the main library module (for details, see the FAQ about this initiative).

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 your Firebase In-App Messaging setup by sending a test message:

  1. In the Firebase console, open the Messaging page.
  2. If this is your first campaign, click Create your first campaign.
    1. Select Firebase In-App messages and click Create.
  3. Otherwise, on the Campaigns tab, click New campaign.
    1. Select In-App Messaging.
  4. Enter a Title for your first message.
  5. Click Test on Device
  6. Enter your app's Firebase installation ID in the Add an installation ID field.
  7. Click Test to send the message.

Firebase In-App Messaging sends your test message as soon as you click Test. To see the message, you need to 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