React Native – Integrating Push Notifications using FCM (Android) – Part 2

Tram Ho

In the previous article, I have instructed you to set up the iOS side and this article I will continue the remaining task of setting the Android side.

I. Create Application On Console.

You go to the firebase console page. Make sure your google-services.json is placed in the correct directories.

Download the google-services.json file and place it in the directory tree as follows.

2. Install Firebase Module

You install it Here offline.

Reconfigure the gradle file. Please use the latest firebase dependencies available while following this guide. You can find official FCM instructions here. For your reference, my class files are as follows:

And setting here.

Setting image displayed on Notification for android

3. Receive Push Notifications

Please run the application with the virtual machine. Note that, In Android, if you want to test on the emulator, you need to install the Google Play Services package.

Below is a snippet of my Notification Listeners setting. You can consult

You can request Notificaiton access of the device using this function.

Or maybe verify it already has less permissions

This article hopes to be a piece of material for you to refer, or have a problem somewhere during the installation process.

4. References:

https://medium.com/@anum.amin/react-native-integrating-push-notifications-using-fcm-349fff071591

Chia sẻ bài viết ngay

Nguồn bài viết : Viblo