Closed osamamukhtar30 closed 1 year ago
Hi @osamamukhtar30,
Thanks for raising this concern. I believe this feature request is similar to this thread. A current limitation on this SDK is that the push payload data model is only accessible via the native iOS layer. We are currently investigating how to implement this behavior such that we can expose the push payload in the Javascript layer to make it more convenient for integrators (rather than create adhoc APIs on each native platform to use).
We will keep you updated when we make more progress on defining and implementing this feature. Thanks!
@hokstuff Thanks for the clarification. How is it possible in the current SDK to handle navigation based on the notification type?
Because as I said Linking.addEventListener('url', (url) => { console.log(url); });
is not working when I send a test notification from the dashboard. And Braze.getInitialUrl
only works if app is launched from kill-state.
Could the reason for Linking.addEventListener('url', (url) => { console.log(url); });
not working, be because the Deeplink is generated through firebase? Because in all other cases it works (which means Deeplink is correctly configured).
Hi @osamamukhtar30,
If I'm understanding your concerns correctly, I believe you are able to handle navigation based on the notification type in the current SDK only in the iOS layer. You will need to follow the native setup instructions here and implement the relevant iOS delegate methods (in Swift or Objective-C) in order to access the notification type. This might also explain why your Javascript code doesn't have the expected properties populated, since that data is only available in the iOS layer.
If you have further questions, feel free to reach out to support@braze.com with your current integration details and attach a link to this thread. Thanks!
I am closing this public issue as a dupe of this other feature request for listening to push notifications in the Javascript layer.
What problem are you facing?
I have the iOS setup correctly. The notifications are coming in correctly in background. In foreground I see the log in Xcode that the notification came but there is not way for me to access the payload in React Native JS code. I use firebase dynamic links for deeplinking. As far as foreground is concerned, I can use in-app-messages and show custom toast for navigation. What about background? I want to handle user's push click behavior.
Braze.getInitialUrl
also only works if the app is launched from a killed state by pressing on a push.Linking.addEventListener('url', (url) => { console.log(url); });
also doesn't work when pressing a push notification. It does work when I press on the Deeplink from some other app like Notes.How do I handle navigation when the app is not killed and a notification arrives?
Workarounds
Unfortunately I haven't been able to find any workaround after searching for it thoroughly.
Ideal Solution
A callback just like android. I want the payload inside the notification. The Key/Value pairs. I don't even want to do it with deep linking. I can use those Key/Value pairs to do my navigation just like firebase has been doing for a long time. Something similar to this
const pushEventSubscription = Braze.addListener( Braze.Events.PUSH_NOTIFICATION_EVENT, function (data) { console.log(
Push Notification event of type ${data.push_event_type} seen. Title ${data.title}\n and deeplink ${data.deeplink}); console.log(JSON.stringify(data, undefined, 2)); }, );
Other Information
No response