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.

Better documentation for cancelLocalNotifications() on Android

See original GitHub issue

The documentation states that userInfo is iOS only, however, it states that you can use a userInfo dictionary as an argument for cancelLocalNotifications().

Could someone whose more familiar with this library update the documentation to clarify:

  • What does the argument for cancelLocalNotifications actually do (if anything) on Android?
  • How do you cancel individual scheduled local notifications on Android? (What parameters can you use to match notifications?)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
sticknorcommented, Jan 18, 2017

Hi, I was able to finally find success with this cancelLocalNotifications method.

The README leads us to believe that the following will work for android: PushNotification.localNotificationSchedule({ userInfo: { id: ‘123’} }); PushNotification.cancelLocalNotifications({ id: ‘123’ });

But it does not…

Instead, do this: PushNotification.localNotificationSchedule({ id: ‘123’ }); PushNotification.cancelLocalNotifications({ id: ‘123’ });

3reactions
KatSickcommented, May 1, 2017

Confirm it working. But only with string type of property ID

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android – Delete previous notification(s) using react-native ...
cancelLocalNotifications({id: myId}) , but the documentation explicitly says that cancelLocalNotifications() only cancels scheduled notifications (and I'm ...
Read more >
Delete previous notification(s) using react-native-push ...
The docs for react-native-push-notification state that you can cancel a ios local notification using userInfo like this: PushNotification.
Read more >
react-native-fcm-fix: Documentation - Openbase
cancelAllLocalNotifications() FCM.cancelLocalNotification("UNIQ_ID_STRING") FCM.setBadgeNumber(1); // iOS only and there's no way to set it in Android, yet.
Read more >
Local Notifications | React Native Notifications
postLocalNotification() method return unique notificationId values, ... of the iOS equivalent that works more naturally with the Android perception of push ...
Read more >
react-native-push-notification - npm
React Native Local and Remote Notifications for iOS and Android ... NOTE: localNotification() works without changes in the application part, ...
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