Pass data to localNotifcation and receive it in onNotification event
See original GitHub issueHey there!
I am trying to pass data to a localNotifcation and receive it in onNotification when i have clicked on it:
My code at presents:
PushNotification.localPushNotification({
title : 'Title',
message: 'Message',
data : {
venueName: venue.name,
venueType: venue['@type'],
venueId : venue['@id'],
type : 'venue'
}
});
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: function (token) {
console.log('NOTIFICATIONTOKEN:', token.token);
Helper.registerDevice(token.token);
},
// (required) Called when a remote or local notification is opened or received
onNotification: function (notification) {
const {dispatch, User} = context.props;
let type = notification.type;
if (notification.userInteraction) {
switch (notification.type) {
case 'venue':
alert('Go to Venue View')
break;
}
}
},
popInitialNotification: true
});
I can pass the data to my localNotifcation, but when i have clicked on the PushNoti, and debugging onNotification, then there is no data. Simply this is what i get:
Any ideas?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How to pass data to push notification with react native
How can I pass my pushMessage(chat) into the notification? I have this onNotification and PushNotificationIOS error when received push message ...
Read more >Local Notifications In Flutter. Notify Your Users - Medium
Notifications are an excellent way to engage your users to go back to your application or to make them to pay attention to...
Read more >Receive messages in a JavaScript client - Firebase - Google
In order to receive the onMessage event, your app must define the Firebase messaging service worker in firebase-messaging-sw.js .
Read more >How to Set Up Local Notifications in Flutter - freeCodeCamp
Notifications are an excellent way to engage your users or to get them to go back to your application. You can also use...
Read more >flutter_local_notifications | Flutter Package - Pub.dev
A cross platform plugin for displaying and scheduling local notifications for ... Getting details on if the app was launched via a notification...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@BigPun86 Can you try showing the notification like this and check if you get the data in the notification. Essentially, don’t wrap it in
data
I am using it this way and I am able to get the data in notification handler.
@mcmatan It was an Android issue