question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Notification not cleared and got error while clicking FCM or Remote message

See original GitHub issue

react-native and library version :

 "react": "16.13.1",
  "react-native": "0.63.1",
  "react-native-push-notification": "^4.0.0",

1. I am having a problem of clearing notification when user click on the notification which was sent from FCM console or Remote FCM message. I tried this

PushNotification.cancelLocalNotifications({ id: this.lastId }); PushNotification.cancelLocalNotifications({ id: '' + this.lastId });

But none of these worked.

2. When user taps the notification to open application, i am getting error undefined is not an object. Below are the errors

Screenshot_1595137819 Screenshot_1595138081

image

What are the proper way to handle notification, FCM and FCM remote message ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
luigbrencommented, Jul 19, 2020

@vishwa1937 as i explained in the other topic, when the app is open, you get the notification and the data is received through the data{} object, but if the app is closed or minimized! and you click on the notification to open the app but the data doesn’t come from the data{} object, you have to access it directly

onNotification(notification) {
        if (notification.data) { //// **APP IS OPEN**
            notification.data.title
            notification.data.message
        } else { ///////**APP IS CLOSED!!!**
            notification.title
            notification.message
        }
 },
0reactions
github-actions[bot]commented, Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase cloud messaging notification not received by device
I do receive a one-time error immediately after pushing the notification that states "I/FA: Tag Manager is not found and thus will not...
Read more >
Receive messages in an Android app - Firebase - Google
Notification messages delivered when your app is in the background. In this case, the notification is delivered to the device's system tray.
Read more >
Push Notification Troubleshooting for Android - Braze
This article covers potential troubleshooting topics for your Android push implementation.
Read more >
Notifications Not Shown - Mobile Push
When an app is in a Force Stopped / Force Killed state most events including FCM messages for push notifications will not be...
Read more >
Troubleshooting Duo Push notification issues on Android ...
If you can approve a request by manually leaving and returning to the app and tapping the Approve button in the Duo Mobile...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found