Push Notification in React Native Android with firebase (send by console)



1. Setup a react native project with command line(cli).


2.  Now you can take reference from blog or continue with this- Click Here



3.  Install React Native Firebase from NPM:



4.  Create Firebase project  go on android-






5.  Paste package name of your app in firebase and give name then download json  file.




6.  Setup google-services.json inside App folder.
place this file in the root of your project at android/app/google-services.json.



7.  add the google-services gradle plugin as a dependency to your project in the project level build.gradle file:

8.  To apply the plugin to your project, add the following to the VERY BOTTOM of your app android/app/build.gradle file:

 9.  Add Firebase modules-
In the android/app/build.gradle file, add the following:

10. In android/build.gradle check that you have google() specified in the buildScript repositories section:

 
 
11. Add the Firebase Cloud Messaging dependency and
 optional ShortcutBadger dependency to android/app/build.gradle

 
 
12. Install the RNFirebase Messaging package
Add the RNFirebaseMessagingPackage to your android/app/src/main/java/com/[app name]/MainApplication.java:

 
 
 
 13. In mainfest  android/app/src/main/AndroidManifest.xml:

 
 
 


 14. Make App.js like below code-

 
 
 
 
 15. make index.js like below-

 
 
 
 
 
 16. make new js file bgMesseging - 

 
 
 
 17 . if u send notification with php web api it will work 
       u can also try to send by console of firebase.
 
 
 
        Download full source code- CLICK HERE 

Post a Comment

2 Comments

  1. How we can style firebase notifiction?
    Fonts, align.

    ReplyDelete
  2. Great blog.
    The details that you shared regarding React Native Application and process of developing the app in really good and simple to understand. This blog with the application development code will help everyone to understand about React Native. I was searching for react native app development company and got his blog.
    Thanks for sharing such a great blog.

    ReplyDelete