How can I control push notification ON/OFF according to conditions? in React Native - react-native

I am making a push notification feature using reactnative push notification.
If I create a channel according to the reactnative push notification official statement, I can control it only when I enter the notification category in the application information of the application.
Can I use the reactnative push notifictaion library to control when I create a component within the app like Youtubemusic (below Image) and implement the push setting ON OFF control function? It doesn't seem to be in the official documentation.
I'm trying to implement this feature within the app, but I'm curious about how it's implemented in practice!
i'm not using local notification just remote

Basically, you have 2 way to achieve this: on backend side or on frontend side.
Backend
Send to backend current state of toggle settings inside your app. When backend want to send push to client, it is internally checks state of this toggle and make a decision send or not.
Frontend
All your push notifications must be send as data only and with high priority (contentAvailable: true, priority: 'high').
After that, only mobile app will control showing of push notifications, because data only push not display anything, just trigger mobile app about new message.
So, when your frontend app receive new push message, it check current user settings and make decision display it or not.

Related

Expo/React Native : A Continuous Alarm or Sound Notification (like receiving a call ) triggered by remote server

I am using Expo to build an app that will pop up a notification with custom sound and vibration when triggered remotely. The alarm/vibration would play until its dismissed by the user or it times out (say after 1-2 mins) .
Example use case would be when a partner needs my immediate help with baby, they can press a button the app and that would send signal to backend server which would then trigger the notification with alarm on the app at the other end. When the notification is dismissed, an acknowledgement message is sent with Yes or No type message. If the notification times out, then another message is sent like "no response".
Key point to note is that when the app is fully closed, the notification should still be able to pop up.
From my limited understanding , expo notification or push notifications in general cannot achieve this as they don't allow us to create notifications that directly open the app. Even a solution which works like phone or video calling apps (which open when someone calls you ) could work.
Any help would be much appreciated.
Many Thanks!
I looked up expo push notifications but they are limited in terms of customising the notifications.

selecting react native push notification

I am using react native and trying to add push notification.
My application need push notification because of chatting. I just need push notification to appear whenever the user receives chat message.
I've searched couple of libraries about push notification and found out firebase and react-native-push-notification.
Which one is proper library for this case and please tell me if there is other better way to solve this problem.
We're using invertase firebase notification library which is working so far better without any issues.
You'll get almost all the options which you needed for push notification customization like badges, etc.

How to handle recurring push notification reminders in React Native

I'm working on a React Native app where I need to send recurring push notifications at specific times. So for example, the user will toggle the app to remind them to do task X every day at 12:00pm and I want the app to send a push notification at 12:00pm (when the app is in the background) to remind the user to complete task X.
For the React Native app, I'm using expo and I've read up on their documentation; however, I'm not quite sure how to handle these reminders.
a) I don't know how to monitor recurring events, i.e. how can I set up the app to know when it's 12:00pm, especially given that the app will be running in the background or potentially not running at all, and
b) I'm not sure if these push notifications should be sent locally within the app or from the app's API/server.
Ideally, I would like to use expo's push notification feature, but I'm open to any suggestions as to how to get this set up! Thanks.
a. ) You should look into node-cron or node-schedule for scheduled push notifications.
b.) It depends on the situation. If you are performing a complicated reminder, such as running a query to check if the task is completed, and sending a notification if it is not completed, then the scheduled push notifications should be sent remotely from the api/server. Else, you can use the react-native push notification to send a local scheduled notification.

how to extract parameter from Branch.io deep link url getting via push notification from Locality's. in React native

I am using Branch.IO to generate deep links. Now the normal flow works perfectly. Opens the application on tapping the link from the mobile browser.
The problem is when I put the deep link URL in the payload of notification and tap on the notification. I will get deep link Url but what is the best way to redirect on particular screen based on url parameter in react native?. i am not getting parameter
i am sending notification via locality's
Thanks in advance.
You can send custom data in the payload of the notification, may be a notification type and use that type to show the desired screen on notification tap.
For how to send Custom data in payload please check:
Apple Push Notification with Sending Custom Data

Make app not open on push notification clicking

I am developing an app which enables pushNotification.When the app in inactive mode it receives push notification.When user click push notification app is opening.I do not want to open the app on push notification clicking.Is it possible do so?thanks in advance
There is no way to do this. Why do you want to do it anyway? You should probably use sound notification instead of banner/alert if you don't want user interaction.