Push Notification
Integrate FireBase to the Application#
Step 1: Create Project in the firebase console using your app package name. Ex: com.testapp
Step 2: After the project creation download the google-service.json file which is automatically generated.
Step 3: Add the google-service.json file to your android Application with in the /android/app/ folder.
Installation#
Install the react-native-firebase package in your project.
Using NPM:
Using Yarn
Configure Firebase in Android:#
To allow Firebase on Android to use the credentials, the google-services plugin must be enabled on the project. This requires modification to two files in the Android directory.
First, add the google-services plugin as a dependency inside of your /android/build.gradle file
Next, execute the plugin by adding the following to your /android/app/build.gradle file:
Lastly, execute the plugin by adding the following to your AndroidManifest.xml file:
Register User with FCM token#
Request Params#
| Status | Description | Type | Required |
|---|---|---|---|
USER_IDENTIFIER | Unique Id to Register the User | String | true |
FCM_TOKEN | Unique Id | String | false |
Note : Unique ID assigned for each user Ex: 12345678 (any alphanumeric). The below characters is not allowed in userId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@) userID should follow below specification: https://xmpp.org/extensions/xep-0106.html
Response Params#
| Arguments | Description | Type |
|---|---|---|
| statusCode | Status Code | Number |
| message | Success/Error Message | String |
| jid | User Jid | String |