In the mobile applications world, Notifications are the most crucial part of business that helps to engage your users actively. It is considered as alerts or messages sent to the users from the application. These notifications appear as sharing short content in form of pop-ups or banners on users' notification screen to inform them about events, updates, or any other important information from the app.
Notifications are essential tools for conveying timely information to users across various platforms quickly. It can be sent to various devices like mobile devices, desktops, laptops, and web applications and can be sent in the form of notifications, in-app messages, emails, and SMS notifications, each of these serving distinct purposes and contexts. We’ll be focusing here on Android Mobile Notifications using Firebase
Benefits of notifications usage in mobile applications:
- Timely Information Delivery: Keeps users informed about important events or updates as they occur.
- Increased Engagement: Enhances user interaction and engagement with applications and services.
- Convenience: Allows users to receive and act on relevant information promptly without needing to open specific apps or websites.
Let's begin with implementing FCM to your mobile app, make sure that your application is connected with Firebase Project. If not please read this instruction to integrate Firebase with an Android App.
Connecting Android Project with Firebase
- Follow the procedure of Firebase and android app integration
- Under the ‘Tools’ select Firebase.
- Navigate to ‘Cloud Messaging’ and check that the project is already connected to firebase or not.
- If not connected, follow the instructions by ‘Firebase assistant’ to connect your project
- Thereafter, follow the further steps of building FCM (FirebaseCloud Messaging) connection.
![](https://lh7-us.googleusercontent.com/04PtaO1pdp9dPl3_txDrF7oIBp96yZAqadJoUBVTQtyCVyouiJST7FV_NSYU9_y8litCJSOgtFDURhvg21qJWYTlMjXI5ivRm6NnVOWrQIKQcYDzNbvRaXya-qfBo1g7i8XuKZDBPIAqCQCzImj15xg)
![](https://lh7-us.googleusercontent.com/-dSmbTtnYwNk-pXDggOzEbwhDdGlLfpZNVIYjDlqzVaBOyxIXB8btZhdGh4rhygAEbxF0ymc3oMtqDDhV3YQSWJ5F1tbAkmuqsaFlGrFO1spblPyRs6y63oGNVHM1fpdsCB9VSfcMs6Ofc9lJm3TrdI)
User Permissions
Ensuring notifications do not infringe on user privacy is paramount to maintaining the importance of their consent. This is configured within the AndroidManifest.xml file, which declares the required permissions for your app. You need to declare the ‘POST_NOTIFICATIONS’ permission.
![](https://lh7-us.googleusercontent.com/GxfcN-PlpFvoLd9Vl2KulzLkYefLwGnpkT5vRE-Uq_1V7WIVWZiBjq2bJFnUbXQ_uZ2mNU7AEi9HsYwl0D_h2ktFSLso-gDVed4-hpEFp1OExRaAijLiatyQzHFL6vL5JjnavJqadclaSmLZP3FFiI0)
Note that, if your notifications depend on network data (e.g., fetching notification content from a server), you need to declare the INTERNET permission.
![](https://lh7-us.googleusercontent.com/qoOdvCDS_A_-1cEqs-RYC-VruWFUtYBVyG9tGX-zJ6E3qnaXRPljFEXHQSzK4sJtJROYJY5W6AdFLo03bF_XRrLncC-5V1AQVQSCyPDjt3EWLrG_4wwbOdlBfyd7UlWVNQE0SS-Yg1WuglCb0ILA5uQ)
Testing Notification
Navigate to the Firebase Console to test your notification service.
- On the left panel, under the ‘Run’ section, select the Messaging option.
![](https://lh7-us.googleusercontent.com/AwDBeaimZOtEPfln7cdfOy6FRdoGJ9_4WAZAxfR9qDY7vMjhhzXVRE2JV1diw9BLlITdESxTiA7I3HcZXfiW9o91UQ95Rb_7aJgZ-XKJqDpzwjQCz56hWkp7n0_xE9_EK7z3K6QNUY-6MSJyx0jPojM)
- You will observe the below screen on selection of Messaging, if you are creating it for the first time else it will show another screen showcasing a list of messaging configured.
- Hit ‘Create your first campaign’.
![](https://lh7-us.googleusercontent.com/d-xsBCWFmFMf5R2dwfO1Hlgmwc5v2Njv97R0bEk0IecifJulMX1sTYe_dR0AcW_41oHkcXKtHsIZ3-qoZyRDrW5uZDYtJik1pg_A8pAoSQg0EiIO2zYYhJdvQzJhWbxDXx8PZmlYv-UEoBKIMxCtY-I)
- A pop-up box appears to continue with your choice whether you want Notification service or In-app messages.
- For now, select the first option -> Firebase Notification messages.
![](https://lh7-us.googleusercontent.com/MphCcYs4_vLEsVAUFkLOStOEFTr1Bs4bcEux7AodLYsPwqtoNHmfni5kxRN_1OoUnDbEY54J0jl3zjD6jfX8FC6jEbCRv4vBsHnu_jpwxUSLZZSYsqxAdrj63xHZzq6066JZEr6v0o_LzvgreGhNKrM)
- You will be navigated to a Dashboard for Messaging, where we will see two categories. One for ‘Campaigns’ and other for ‘Reports’.
- Hit ‘New Campaign’ to begin with our first notification.
- A new pop-up window will appear to guide you through the creation of the notification process.
![](https://lh7-us.googleusercontent.com/uKER1noA5p1VfrrDJ-cPOCvyKbu6WkIsIrYBkFbw0IxQlnQWWaX-h8Rw4pOAqcmTNjWiSpC5_jnzc0raxU9JOtS2yCQjD2siSrl-Ac-uNUh_cnIiM2CAihqWTzpTXHF9Fg6JWhSNQMKWycTP23FoNWY)
Campaigns, Helps to generate Notifications and run campaigns based on specific audiences to target to this group
Reports, Gives reporting insights on how notification campaigns are performing
Let’s dive in and create one Campaign using Notifications.
Create Notification in Firebase
Step 1
Add notification details. Where you have to mention the title of the notification and its description. On the right-hand side, you will observe the preview of how the notification will appear to users of Android/iOS.
You can send notifications to
- Click next to continue with further steps.
![](https://lh7-us.googleusercontent.com/lhcShHoY8s7IhsSbA0_SfKZuRwQCxy9pQVozdrUhIxJ83sUsB3jgiBwXKynBMbX3l8TmdRXQwot16wX7iqobuFmvqphdq2Uh7MWA6ZB3EdH5oILtFcbhtQuRW9yC3q-JJOh_zZh6OvtXx9_Nc0adRvU)
Step 2
This step includes the target application for your notification where you have to select the ‘your_application_package’ name.
- We can also target other apps as well having the same targeted audience for notification.
![](https://lh7-us.googleusercontent.com/gfxi6JF_wmAJgszhcRtUgg5BgUFU6QMe2OPZnaoOQBza3GGbk9wfHOkgy88XI6hDa7czJHoOzjyGHHY6saoPsziwUif6dODMFHnwJ2JntuiPf7D-K1N4KDVOc6QugKMlQKS779OVfVR8WpT62gi5-VM)
- The next part is to add Topic to your notification. This is mainly used for alerting specific targeting audiences on real time updates like weather forecasting.
- For example: Users of a local tide forecasting app could opt into a "tidal currents alerts" topic and receive notifications of optimal saltwater fishing conditions in specified areas. Users of a sports app could subscribe to automatic updates in live game scores for their favourite teams
- You can learn more about Message Topic here.
![](https://lh7-us.googleusercontent.com/fHJeCKB5GAKU8ado8DL0tVrWZ9E6AnC1uoGXtDeeBitl15XPx5hxMCLB9YULS2I2tt5iaozC2l5B8Qil7D0pSOZXcojHLfjkbCxAPtdvmQyeIirM0tzwNuyzq9GUCksczWivmVJF4vyvUAoMBtnaW3o)
Step 3
This step includes scheduling of your notification.
- You can either select ‘Now’ to review the published app or select date and time with the available options.
- There are multiple options available to set a specific period to circulate the notification based on our requirement. Such as ‘Now’, ‘Scheduled’, ‘Daily’ and ‘Custom’.
![](https://lh7-us.googleusercontent.com/qHbgIGavPG2Ped_I_67KGE2ZeCXhnNeD31zoyDRFmFZOYIrlUWLhwmE8HwS8WkpsHJMo8EUhnCQGpMGklXyjCksl3WHcHN1TpevQpY3v6ee0MUuaRkWoMe_LgZmF_UAG6OSozFcawU2mmPqORFtVS7w)
- On selecting ‘Scheduled’ you can set the exact date and time to trigger your notification.
![](https://lh7-us.googleusercontent.com/Aiu9XHbmyUrBTCmE6qxDV-xxQMFZZIbEKpaDoXwa2b6e1xxFNToovin2VmWel2zdZVHxfLerkF2h7-k9EXAlpPhwSfw4UygeydzT5i2-sTn25aFJHFwtszR2smh-SVbha_YBdsNsYF1LjTD2KVKD_nM)
- On selecting ‘Daily’, our application’s user receives notification on a daily basis based on the time predefined in the console.
- We can also set the duration of Daily notification. For instance, You want to notify your users for a particular period, you can predefine the starting and ending date for daily notification.
![](https://lh7-us.googleusercontent.com/6VQHs5_BPKdFXZm35iRNDIaX-d_spnQ5BQQxyZYUfKPPL-TAdb4AEss0PEuKLKEoXT4Y9vWyzHNN4bIBasBWsUxgo4FQqoy8oEZj1lDRkQQRrOzxye3Z7gmmXLX7LKmXibDAvgCMRXO6hUqSY7vrSRU)
- On selecting ‘Custom’ we can add notification repetition based on weeks or days, by choosing custom days of the week to trigger notification just as depicted in the image below.
![](https://lh7-us.googleusercontent.com/bw_ZG5g3MZe8wxkaoOfMlRxj8YY19qwjc9tAlSA5oa7S6s93Dr96ugjnUcH4axn0xObiNj7oxGE4V59tzNJgGZGil_OjuH_vSMfs-RyFabqmWQe3aM7gaHBdvwW03HGn-QbqpMhAWCjoLQrB3HHXlbU)
- Let’s select ‘Now’ for this example, as we want to get results instantly on how our test notification performs.
![](https://lh7-us.googleusercontent.com/rvq5GGfEE56rVH0LGthqW4QSrnpGtc2NFJtoWmA7wzE1jbqx2ejn3WFRHWtWqIU-b2tr3BeakiHJ30Nau3z9VM47UqB85UsCfbmTzT7xE5Zl9h7q1exQ4KUnL1NwojoHSw4o6UgYJYcaJCTutINJ-QE)
Step 4
Key Events can be adjusted according to our goal for the notifications which user action you want to observe.
Here the key events are marked or recorded only if the notification is reached to the potential user and the user opens the notification. It will help to bottle neck the funnel of the events.
![](https://lh7-us.googleusercontent.com/PWHduS702k-_sEICyAbDewtgfJPB18StXUxYCHLU9IukkP0veWIVfmuw1IM1gDsxardMEYhYH6VU_gEB46o5_HqU2iZ8Zb31IOS8p79O9xRPp94NIThuYWkj9khLvJB1a6l4FIOF1aZWiRzqrCNbIL0)
Step 5
Additional Notification settings include adding channel ID with its Custom key and value.
- Channel-ID is a unique String to identify each NotificationChannel.
- Here Custom Key/value pairs will be delivered with the message to your app.
- We can also Enable or Disable sound for the notification.
- Further, we can also set the Expiration date for our Notification Campaign.
![](https://lh7-us.googleusercontent.com/aepXcxCQiWlmvb3eGoaa60LtU4HJQygYbvu5T-8fdwZnSKilinMgai4CMFYVpxrvPQQ0YrK262VlHfVjzFiZVFMTPruWZ3fV0fA2dmTuGV_CqrIxxzammOhHpHQmUPq9kt1wTLuUlVf3HtFlwOeeZ9I)
- After completing all the steps of setting up our First Notification Campaign, we can then move forward by clicking on the ‘Review’ button to review our campaign.
Step 6
Below image depicts how your Notification will be viewed on an Android device.
![](https://lh7-us.googleusercontent.com/IoE-rZTsMMmPhgLALvpS6TRjxIS3iVwdTmPq2pOEcpr3o5ZLhPUtHVX-Oy35buGBVttj60dospR3tg6PQ_vDpN29fMuyHhZBzwvy8R456KS1__xPtKUyTSYgY47XE_8R-2Eip1M9SZvqy3rHChBAE2o)
Step 7
View Campaign Dashboard and analyse metrics like sends, clicks, opens for individual notification campaigns.
![](https://lh7-us.googleusercontent.com/XWrXI-8PfElxKVJHf-sJ4tdsQ4H8Rb70HwZ9fbaWYL8-JxrxL2ZLvT6xdqN82YfLV6UFvnw1zJXFOz2qPCQdQAN269M-ad8lXWWanouNIcprcSDIX3NAnvB_S9eDVYoUffSRAVe2qamqwur1kvKkd4I)
Step 7
Repoing insights, helps to understand the trends based on your notifications metrics like sends vs opened and understand how your notification is performing. It is visible under the ‘Reports’ tab.
The data can be exported in CSV as well for future purposes.
![](https://lh7-us.googleusercontent.com/O3LpiVsLwlppl463uzsLfuiBIJ225n_-zVjXodwuE0sdWBbweTFnXPIT_iwE97RlfZNcMsRPHabXVZPRDHx-Hf9fUbrRt4dT5mLURRBcjeZoj2Wfykg2aI4_glzqheNokknxuPTZ2BRBJioeG3-aWXc)
Conclusion
Notifications play a vital role in user engagement within platforms like mobile applications. You can send anytime even if the user is not active in your application. In this blog, we explored how to create, implement and schedule custom notifications using FCM - Firebase Cloud Messaging.
Implementing these strategies, can enhance the user experience, prevent information overload, and build lasting user trust.