Clicking the notification with the app in foreground has data missing
See original GitHub issue@evollu
I’ve been working on getting the on click working properly for my notifications, currently focusing on android. I have the on click for killed, and background working great but I’m having trouble when the app is in the foreground. When the notification is first received, all the data I need is there but when I click on it all the data I need for my on click function is stripped out. Is there a solution for this?
Console log for when notification is received:
Console log for when that same notification is clicked:
My payload is:
body = {
"to": this.chat.token,
"content_available": true,
"priority": "high",
//"click_action": "fcm.ACTION.OPEN_NOTIFICATION",
"data": {
"senderUid": this.user.uid,
"chatDocId": this.chat.docId,
"messageDocId": messageDoc.id,
"show_in_foreground": true,
"companyName": this.chat.users[`${this.user.uid}`].companyName,
"groupChat": this.chat.groupChat,
"color":"#a7ffeb",
"priority":"high",
"id": this.chat.docId,
"show_in_foreground": true,
"sound": "default",
"click_action": "fcm.ACTION.HELLO",
"vibrate": 300,
"lights": true,
"senderUid": this.user.uid,
"chatDocId": this.chat.docId,
"messageDocId": messageDoc.id,
"body": messageText,
"title": this.user.displayName,
"icon": "notification_icon",
},
notification: {
"body": messageText,
"title": this.user.displayName,
"click_action": "fcm.ACTION.HELLO",
"sound": "default",
"vibrate": 300,
"lights": true,
}
So to be clear the the important data that is missing is
"senderUid": this.user.uid,
"chatDocId": this.chat.docId,
"messageDocId": messageDoc.id,
"companyName": this.chat.users[`${this.user.uid}`].companyName,
-
What version of RN and react-native-fcm are you running? “react-native”: “^0.49.3”, “react-native-fcm”: “^12.0.0”,
-
What device are you using? (e.g iOS9 emulator, Android 6 device)? Android
-
Is your app running in foreground, background or not running? foreground
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top GitHub Comments
@rtman got it searched in settings, it was inside some security settings, may be its different in Mi phones running 7.0 . Thanks a lot for the quick reply.
@sahil290791
You have to enable AutoStart in Settings > Installed Apps > Your App Name > Autostart.
Really annoying that xiaomi does this.