react-nativepush-notification

How can I make a react native application with push notifications and an API


I am building a new application in React Native and I built an API for the back-end. I want to build in a push notification in the app when there is a new entry delivered by the API. I saw a framework that background fetches an API route and then shows a push notification but this only applies ones every 15 minutes. Other push notifications tutorials I see only work with a Firebase database and I need it to work with my API.


Solution

  • step 1:- first you need to add react-native-firebase, messaging in your react-native project for receiving push notification.

    link to add react-native-firebase

    step 2 :- check your application setup using firebase console's Cloud Messaging service. https://console.firebase.google.com/project/fir-demo-f375c/notification if your application setup is perfect you will get push notification in device from firebase console's Cloud Messaging service.

    step 3:- need to add server side code to fire push notification from server, when your api hites to using server language like PHP. for more detail in step 3 follow https://firebase.google.com/docs/cloud-messaging/server#implementing-http-connection-server-protocol