Push Notification
#
Integrate FireBase to the ApplicationStep 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.
#
InstallationInstall 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 ParamsStatus | Description | Type | Required |
---|---|---|---|
USER_IDENTIFIER | Unique Id to Register the User | String | true |
FCM_TOKEN | Unique Id | String | false |
#
Response ParamsArguments | Description | Type |
---|---|---|
statusCode | Status Code | Number |
message | Success/Error Message | String |
data | Username and Password | Object |
#
Sample Response:#
Background Message Handling ConfigurationPlease add the following code to your index.js
file
Sample Response: