I'm really confused on how notification listener works in expo, especially for a killed app, I read the doc and I knew that addNotificationResponseReceivedListener listener use when the app is ( in background or killed). I need to know how this listener work and when I unsubscribe the listener does it keep listening?
this callback is called after the user taps on the notification and the App open. you will receive an object with the push notification info (like title, message and extra data) and from there you can decide if you will redirect the user somewhere or just resume the app flow.
If the app is not subscribed (if you didn't generate the token for push notification) you will not receive the notifications.
If you just didn't create the callback responseListener.current = Notifications.addNotificationResponseReceivedListener(response => {..... your app will show the notifications anyway (normally you just use the callback when you want to do some action with the notification info)
Hope this info helps.
Related
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.
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.
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
I have implemented interactive notification using two actions. When app is not running, and i get 4-5 notifications on lock screen, then if I submit any one action, it clears all notifications automatically, this should not be done. I have just called one webservice on that action. Not clearing all notifications manually, still having same issue.
Video Link https://www.dropbox.com/s/fszdsgnrn7rfb2h/Voicee_issue.MOV?dl=0
You can find my code here :
https://www.dropbox.com/s/5gp5tzcryhlwtyk/appdelegate.rtf?dl=0
I'm building a windows 8 application wish toast notifications that are pushed. I know that when the toast is clicked, the application is started, possibly with the ability to see the payload of the toast that launched it.
However, is it possible for me to send additional data that can be interpreted by the client (like a unique id), that is not shown on the toast?
Take a look at the launch attribute of the Toast schema. What you put in there is up to you. When the user clicks on the toast, the app will be activated with an ActivationKind of Launch, and you can grab the string from the args passed into the OnLaunched handler (see How to handle activation from a toast notification)