Can I modify expo push notification title/body before showing the notification? - react-native

I'm using expo notification service.
I would like to send keys from backend, e.g.
{
title: "TITLE_KEY",
body: "BODY_KEY"
}
then translate it when it comes on the mobile side (based on the key), before showing it, so user would not see the key on notification, just the translated text...
So the question is how could I modify notification before showing it to the user?

Related

How can I control push notification ON/OFF according to conditions? in 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.

Cannot register device with TalkJs for push notifications

I am working on a React Native app that uses TalkJS. We want users to get a push notification for every message they receive. The messages are going through but we aren't getting notifications. We have uploaded our .p12 to the TalkJS dashboard and followed the docs for setting up a React Native project. Below is the relevant code we're injecting to the TalkUI loadScript. We followed https://talkjs.com/docs/Features/Notifications/Mobile_Push_Notifications.html
const res = await window.talkSession.registerDevice({ platform: "ios", pushRegistrationId: "${deviceToken}"});
alert("registering deviceToken ${deviceToken} response: " + res)
We are getting the alert with the correct deviceToken but this method does not return anything. We tried .then and an error first callback but nothing is coming back from this method.
Edit: this method is not designed to return anything, so the response is expected to be empty.
The Promise was designed to not return anything as Kapobajza mentioned.
From their support chat: "We have an issue regarding push notifications on iOS when using React Native."
Edit: this issue has been resolved. In addition to work that needed to be done by the TalkJS team, push notifications require a user to have a 'role', as is very loosely implied in the Overview for Push Notifications

Ionic 4 Firebase Pushnotification

I need to know is it possible to need to send some type ID with firebase notification. Where user get notification i want to open the page and pass that ID as a parameter in api ? Is it possible ? OR any one have example ? Thanks
Depending on your need you can send a notification message, or data message, the notification message will be basically responsible for showing a push notification to the device with a title, subtitle and message depending on the operating system (in terms of the graphic environment), the data message will send a notification to the device with the data you want, this notification will not be visible to the user, now if you need to send data but also show a notification to the user you can do it in two ways:
You send a notification of data, when you receive it you process it, you show a local notification and you send by parameter the id that you received.
Send a push notification (with the id specifically in some side as you wish) this is shown by default to the user, when the user opens it, you process the id, and send it by parameter.
I recommend the first option, here you will find more information
Firebase Cloud Messaging

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

iOS 5 remote notification when launching app from dashboard

since iOS 5, notifications are no more intrusive as previous. This is nice, but it seems that users prefer to tap directly on app icon from the Dashboard instead of the (small) banner area or notification center.
In such case, my app cannot get payload from notifications.. Even the 'application didReceiveRemoteNotification' method is not able to get the notification.
Has anyone got the same issue? Do you have any advice?
Thanks
The intention of the push payload is just to display something useful/informative to the user in the alert. Not to actually send data to your app.
So you will need your own web service to provide the data your app needs. Your app should refresh/sync to that service when it launches to get the data.
Example: Instagram. It can push notify you that someone commented on your photo. But it's not actually sending the comment data in the push to display in the app. The comment data is downloaded when you launch Instagram and attempt to view the comment.