Step-by-Step Guide: Implementing Push Notifications in React Native with Firebase (Android)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this lesson we're going to learn how to push notifications using fire base with react native let's open the documentations here and go down to Cloud messaging and press on usages usage there is an important note here and we you have to install the app we have done that before in previous video you can check it in the description and in that video how to connect react native app with Firebase okay now let's install that package react native Firebase messaging using yarn let's install it let's go down to see the documentations here in the usage we're going to use it first with Android first we need to request a permission let's copy that code let's copy the import first and put it here and let's copy that code this function and now let's let's get the token how to get the token let's create a function to get the Firebase token const get token we're going to save the toen in that constant messaging. getet token okay because we are using await we have to add here an async keyword now let's console.log our token console.log token equals to and our token okay and we need to run those two functions when the component get rendered so to do that we're going to use a react hook called use effect use effect we want to make that effect one time so we're going to leave that array as empty and here we're going to call those two functions the permission function to get a permission and the get toen function and let's save now let's rerun our app yarn Android to see we have run our app and we can get the token so now let's try to push a notification just we have to open the Firebase our Firebase project fire base let's go to console react native dream and go to Cloud messaging is here now let's press here and press on create your first campaign let's pick that notification messages and create let's add a title for example hello world this is the title hello world body we can send a testt message here when we press here and we just to add the token we have conso the log that console log the token if we want to send that notification to specific device and let's close our app and let's press test you've heard the notification sound Lo hello worldlet hello worldlet Budd let's send another one for example let's make it new notification the new and let's send another notification let's select our token our token has been saved and press test here is the notification lock new notification then new now if you want to send the notification to all devices let's for example send to all devices let's press next and select an app we're going to select an Android app let's press next schedule now and preview and publish all the app are all the Dei all the devices that have installed our app will receive that notification let's see it just take sometimes we got the notification here see send to all devices now you have learned how to push notifications to Android apps using r for base
Info
Channel: HeroDev
Views: 4,274
Rating: undefined out of 5
Keywords: push notification react native firebase, push notification in react native, react native push notification firebase, notification in react native, react native push notification, notification integration, push notifications, mobile notifications, react native firebase push notification, react native notifications, React Native tutorial, React Native push notifications, Firebase cloud messaging, React Native Firebase, Push notifications tutorial, Firebase messaging, firebase, dev
Id: xoa93byTHs8
Channel Id: undefined
Length: 5min 35sec (335 seconds)
Published: Mon Oct 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.