How can I make a react native application with push notifications and an API - 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.
Is somebody known with combining rest api's with push notifications in react native, that can help me?
Greetings,
Laurens

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

Related

Configure expo notifications for push notifications

I have 2 apps and I implemented expo push notification and everything was fine, but in the other one it asked me for the experienceid as a prop to Notifications.getExpoPushTokenAsync({
experienceId: "#name/slug,
});
and when trying to send a notification it gives me this error: InvalidCredentials: Unable to retrieve the FCM server key for the recipient's app. Make sure you have provided a server key as directed by the Expo FCM documentation.
I dont want to use FCM, i want to use expo push api.
Can you help me?
The Expo Push API uses FCM for Android, and while it's not necessary to configure it for Expo Go (this is done already for the Expo Go app), when you deploy your standalone app you will need to have it configured for FCM. More information here: https://docs.expo.dev/push-notifications/using-fcm/

Creating native Android push notifications for App built with PWA builder

Successfully created an Android app of my PWA using PWA builder.
Also Added web push notifications with the Service worker and web Firebase messaging API.
But due to certain shortcomings of web push notifications, I want to use the native push notifications using firebase SDK for Android instead.
Reading a few of these answers How to use push notification for trusted web activity, Cannot understand how to open a simple TWA inside an app (using AndroidX) gives me the impression that I need to have access to Main Activity and put Firebase onMessageReceived inside onCreate function.
But given PWA builder is a Node application that builds APK, I don't know where to start. I understand that I have to 1. Include the Firebase SDK & 2. Put onMessageReceived
But how to go about it using PWA builder?
Or Is it not possible at all? I need to create a brand new Andriod studio project and add TwaLauncher, from android-browser-helper as some of the answers mention?
Also posted this question on PWA builder issues.
When you are generating Android APK, enable the "Notification Delegation" option.

How to Send Push Notification to Xamarin Android app?

I need to implement push notification to our Android App using Xamarin. Here is the process. We have web version which used by the Manager. The Manager creates and assign job to the driver. The App version is used by the Driver where it shows the list of jobs and processes of job until its complete. So, when the Manager assigned the Job to the Driver in the Web version, it will then notified to the Driver in the App version that "new job is assigned". Basically, both the web and app uses same database then we created an api(REST API in MVC C#) to connect and get data from the db to be used in the mobile app.
Can someone recommend to me which Push notification plugin(a plugin or nuget) should I use to do this? Currently, I have set up Push Notifications through App center & Firebase but not sure how this work.
Thank you.
I need to implement push notification to our Android App using Xamarin.
I would suggest you use Firebase for mobile push notifications for Android as it is a product by Google, and was made for mobile applications. For push notifications, you will be using Firebase Cloud Messaging also known as FCM. See to it that you are well versed on how it works before you start coding anything read the documents it answers most of your questions there itself.
The Manager creates and assign job to the driver. The App version is used by the Driver where it shows the list of jobs and processes of a job until its complete. So, when the Manager assigned the Job to the Driver in the Web version, it will then notified to the Driver in the App version that "new job is assigned". Basically, both the web and app use the same database then we created an API(REST API in MVC C#) to connect and get data from the DB to be used in the mobile app.
For this, you will have to check on how to work with Firebase using Rest-API. Once you configure the Rest-API and then apply your business logic to it things will be quite easier than you might have imagined.
Can someone recommend to me which Push notification plugin(a plugin or NuGet) should I use to do this?
My recommendation is quite simple, Do not use any sort of a firebase push notifications plugin!. I have had a very bad past with plugins and ever since then I never recommend fellow developers to use plugins until it is a well-maintained one. I would rather ask you to simply configure Firebase on the basis of the guides that are available online. Like the following Xamarin.Android guide for FCM. It is detailed contains everything that you are looking for and what else I would suggest is you check firebase related answers on SO and you will find that almost everything that is not available in docs is covered around here and in detail. Like the following:
How to handle Firebase Notification i.e. Notification Messages and Data Messages
Push Notification in android with firebase get token
How to send device to device messages using Firebase Cloud Messaging?
Receive push notifications on one android app from two Firebase projects

Wait for a server message in background in React Native

I'm developing a Messenger/Call app in React Native. Users can call each other. When all users are online there is no problem but when users go offline (close their app) they won't recognize calls. I need to run a service which listens to a specific types of message pushed by server.
I want to publish call signals by google GSM. (I can't use Firebase for some reasons)
Is there any library which I can use it or I have to define my own native module and Link it to React Native?

Firebase Cloud Messaging with serverside API push for obj-c

currently I working to implement Firebase Push Notification in my apps.
I found this:
[background] Using Firebase Console my apps can get the notification from system tray with remote notification
[foreground] Using Firebase Console my apps can get the notification from log, but i can make it into notification center with local notification
[foreground] Using Our Dashboard which managed by PHP serverside, I can get notification from log, but i can make it into notification center with local notification
The problem is, how can i get the notification (log is fine) if my apps in background with Our Dashboard which managed by PHP serverside?
I found that there is different between json I got from Firebase Console and our managed serverside dashboard, is that a problem that my apps cant handle? and how i can handle it? can I get the sample of the code to solve this problem?
This is the different between json i got from firebase console and our managed serverside dashboard
firebase console
our managed serverside dashboard
What you want to do is possible by using the normal FCM api.
Please review the differences between Display-Message and Data-Message here:
https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages
and see all the parameters in the reference page:
https://firebase.google.com/docs/cloud-messaging/http-server-ref