Exploring Firebase In-App Messaging

Firebase In-App Messaging helps you engage users who are actively using your app by sending them targeted and contextual messages that nudge them to complete key in-app actions — like beating a game level, buying an item, or subscribing to content. read more

It is basically a dialog pop-up on user’s screen in order to engage them to perform a specific action or display some information to them, like showing a dialog to update an app from play store and attach the play store link to update the app or display promo image to inform the user to perform specific action e.t.c

To get started, we need to start a new project in android studio and build the new project

When the app finish building we need to add firebase InApp Messaging dependency, you can get the latest from here

Then the Gradle dependency looks like below

That is all we need to display Firebase InApp Messaging in our app, next we need to set up firebase account and add our project.

Head over to the official website here

Click on get started

Then after that click on add project to add the new project that we have created

That fill the next pop-dialog to enter the project title and create it

We need to wait for some seconds for the project to get created

After that, we need to add InApp Messaging to our project on firebase by scrolling to the Grow section of the left bottom of the screen and click on In-App Messaging

Then because we are building for Android, so we have added the android project

We then register and configure the app by filling our project package name as below

Click register app to generate the google-services.json file which we need to copy and paste into our app

Click on Download to download the file and navigate to our project and switch to project view and add it to app section as shown below

We can next to add some additional dependency to support firebase

Open project level Gradle file and add the below dependency

classpath ‘com.google.gms:google-services:4.0.1’

Then also add the below dependency to the bottom-most part of the app level dependency, outside dependencies tag and sync the project to download the files

apply plugin: ‘com.google.gms.google-services’

We then goto firebase and next to the stage and also run the app on our phone.

Wait for the app to build and make it build and run smoothly

After a successful building, we then goto firebase and Create our first campaign

To create a campaign, we choose between Three options, Modal, Image Only and Top Banner, the three will show in the form of dialog and just their position and appearance will differ.

We choose Modal in this tutorial and also choose the Background and textColor as default which is basically black and white

The Title Message is the Title of the dialog (basically the summary of the message you are displaying)

Then we may also fill some optional field to make it more interesting,

We can fill the Body (Which is the content of the dialog and maybe the purpose of the messaging)

Also, we can fill the Button Text (Which is the text of the button to click and can be empty)

By filling the Button Text, we have to fill the Button Action, which is the action to perform when the button is been clicked

Then we move to the target Section of the campaign

Here we fill in the Campaign name, short or long description of the campaign,

An also select the Target user by selecting the package name and also filter the users with some parameters

After that, we move to the Scheduling section of the campaign to schedule campaign

We select the campaign to start Now and also the end date to No end date, this will be depending on your campaign.

Then we move to the last optional field which is the conversion events for monitoring the outcome of the campaign

Then we click publish and wait for it 🙂

The schedule may take some time before it appears on users device but it will definitely show up.

But wait… for development purpose, we can always force the campaign into our testing device by clicking on the overflow menu of the campaign in the list of campaigns

Then supply our App instance ID and click on test, you can check here for help on how to get an Instance ID

And that is it for Firebase In-App Messaging

The project can be found below

sodiqOladeni/InAppMessagingContribute to sodiqOladeni/InAppMessaging development by creating an account on GitHub.github.com

You can further read up:



Let connect here

Thank you for reading

About the author

Sodiq Ogunyeiwa

Add comment

By Sodiq Ogunyeiwa

Recent Posts