Add Firebase In-App Messaging in your Android App

So here we are gonna discussing the latest released( for BETA use) feature of FirebaseSDK which is Firebase In-App Messaging to implement Firebase In-App Messaging.

You can use this awesome feature in your app as per your requirement, dynamically. Without writing the single line of code,…. Awesome ?.

Firebase In-App Messaging is used to grow your app retention,engagement by sending them targeted contextual messages in the form of Modals and Banners form, that encourage them to use key app features.

? You can show Images and Text as well as Actions along with it if user clicks on it, then a particular action will happen. Basically, action will be Dynamic Deep Links

Malik Mehrose

Use cases

  • Welcome messages on the app_launch event
  • Show a particular notice on the app_update event
  • Festival, birthday wish card
  • Show discount offers on a particular day
  • Much more possibilities with it…

Check Also: Import JSON Data into Firestore (Firebase)

Let’s see the implementation of Firebase In-App Messaging.

Steps:

  1. Add dependencies
// ...
dependencies {
    // ...

    // Add the In-App Messaging depencency:
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.0'

    // Check that your Firebase dependency is up-to-date:
    implementation 'com.google.firebase:firebase-core:16.0.1'
}

2. Get Firebase Instance ID ( for testing)

Print your firebase instance ID on test mobile with following code

Log.d("Instance ID",FirebaseInstanceId.getInstance().getId());

3. Go to In-App Messaging console

  • Once there, click New Campaign.
  • Enter a Title for your first message.
  • Select UI among three styles ( Modal, Image, Banner) and customize colors as per need
  • Set Matter -Title, Body, and Image Url
  • Click Test on your Device
  • Enter your app’s Instance ID in the Add an instance ID field.
  • Click Test to send the message.

Note: If you want to test, there is one problem. You have to get a fresh Firebase Instance ID from code and then add it to the test device instance ID in the console and after a click on the Test button, you should kill your app and then REOPEN it to get the result

And then at last Click on Test and see the output

?? Here is my own App and I am using this feature in my app to get updated notifications to users

Reference

https://firebase.google.com/docs/in-app-messaging/get-started

#HappyCoding ?

Clap ? , Share and follow me if you like it ?

Entrepreneur | Investor | Self-taught Developer | Blogger