Skip to content
Related Articles

Related Articles

Firebase In-App Messaging in Android with Example

Improve Article
Save Article
  • Last Updated : 28 Sep, 2022
Improve Article
Save Article

Sending tailored, contextual messages to your app’s active users that encourage them to use important features can help you engage them. This is possible with Firebase In-App Messaging. For instance, you may ask users to subscribe, view a video, finish a level, or make a purchase by sending them an in-app message. You can set up triggers to have messages displayed only at the right times for your users by customizing them as cards, banners, modals, or images. Use Firebase In-App Messaging to promote exploration and discovery. For example, you may draw attention to a deal or a coupon in your e-commerce app, provide hints or tips in your game or ask users to like or share something in your social network app.

Apart from the other numerous advantages of using In-App Messaging in your android apps, here are a few particular:

  1. When messages are most needed—while users are actually using your app—Firebase In-App Messaging sends them. Instead of while customers are waiting in line at the supermarket, advertise your big sale when they visit your in-app store. When consumers are playing your game, not when they are watching the big game, you should draw attention to that cool, new level.
  2. You can send messages to the users you want to contact most effectively with the help of Firebase In-App Messaging, which integrates with Analytics and imported segments. Send messages depending on user demographics, client attributes, or previous behavior.
  3. Firebase In-App Messaging enables you to do everything from providing promotional offers to encouraging users to update to a new version of your app thanks to the ability to personalize your messages’ design, appearance, display triggers, and content with just a few clicks.

Firebase wants to make it simpler for developers to keep users engaged in their apps and point users on the correct path for productive work. Modals and banners are used to deliver the intended contextual messages. Triggers can be configured to appear just as they would have benefited our users the most.

Cases of Use:

  1. To display a greeting at the app launch event.
  2. In order to display a specific message on the app update event.
  3. For displaying a greeting card on a birthday.
  4. For displaying deals on a specific day.

Send pertinent, interesting messages

When messages are most needed and when users are actually using our app, Firebase In-App Messaging sends them. Scale out the large sales when the user visits our in-App store, not when they are waiting in line at the supermarket. When people play our game, not while they are lounging around watching a big game, we highlight cool, new levels.

Send messages based on audience or behavior

Firebase In-App Messaging uses analytics and prediction to give us tools for reaching the users we care about most with our messages. The user’s past behavior, demographics, or even predictions of their future behavior are used to send the messages.

How to Add it to Android App?

  1. Link your app: To begin, in the Firebase console, add Firebase to your app.
  2. Integrate the SDK: Using CocoaPods or Gradle, incorporate the Firebase In-App Messaging SDK into your app.
  3. Make your initial message: To write, customize, and target your first message, go to the Firebase console.

Let’s dive deep into it, but before we get into details, make sure you have added firebase to your android app.

Step #1: Add the initial dependencies

Add the dependency for the At-App Messaging Android library to your module’s (app-level) build.gradle file (often located in project>/app-module/build.gradle). We advise managing library versioning with the Firebase Android BoM.

Adding the dependencies


Step #2: Transmit a test message

Get the installation ID for your app. Firebase In-App Messaging only retrieves messages from the server once per day in order to save energy. The Firebase interface lets you define a test device that shows messages when you request them because doing so can make testing challenging. A FirebaseInstallations ID, or FID, identifies that testing equipment. Check the Logcat in Android Studio for the following ‘Info’ level log to get your testing app’s FID:

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

Step #3: The Firebase Console

  1. Open the In-App Messaging tab in the Firebase console.
  2. Then select New Campaign.
  3. Give your first message a title.
  4. On your device, click Test.
  5. In the Add, an installation ID section, type the Firebase installation ID for your app.
  6. To send the message, click Test.
Setting up the In-App Modal


As soon as you hit Test, Firebase In-App Messaging sends your test message. You must close the app and then reopen it on your testing device in order to see the message.


This is how you will send In-App Messaging to your Android Studio, as you would have understood well, there is no hassle or unnecessary lines of code associated with adding this implementation to your Android App.

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!