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.

Cancel local notifications is not working - iOS

See original GitHub issue
  • React Native: 0.48
  • Plugin version: 3.0.1

Tried both, the cancelLocalNotifications({ id }) with a notification object as:

PushNotification.localNotificationSchedule({
        id,
        title,
        message,
        date: moment().toDate(),
        largeIcon: 'app_icon',
        smallIcon: 'app_icon',
        color: 'blue',
        userInfo: {
            id
        }
    })

Also, tried cancelAllLocalNotifications() without success.

I can confirm that it is working for Android but not for iOS.

Issue Analytics

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

github_iconTop GitHub Comments

13reactions
EyalSicommented, Oct 18, 2017

This is the version that worked for me on Android + iOS (with cancel…):

      PushNotification.localNotificationSchedule({
        id: ''+recordID, // must be id of type STRING so that the cancel will work on android
        userInfo: {
          id: ''+recordID, //IMPORTANT!! adding the userInfo, so that the cancel will work!
        },
        number:0, // must have this otherwise it fails.
        data: {
          recordID: recordID,
        },
        message: message,
        date: someDate,
      });

later on:

      PushNotification.cancelLocalNotifications({id: ''+recordID}); // must be id of type STRING so that the 

cancel will work on android

0reactions
github-actions[bot]commented, Aug 20, 2020

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

cancelAllLocalNotifications not cl… | Apple Developer Forums
I have a similiar problem. The local notifications is not working correctly in iOS 9. Sometimes my app show notification, sometimes not!
Read more >
how to cancel a localNotification with the press of a button in ...
You can cancel a notification using its identifier : let center = UNUserNotificationCenter.
Read more >
Scheduling local notifications - a free Hacking with iOS
If the user grants permission, then we're all clear to start scheduling notifications. Even though notifications might seem simple, Apple breaks ...
Read more >
Notifications - Expo Documentation
The expo-notifications provides an API to fetch push notification tokens and to present, schedule, receive and respond to notifications.
Read more >
Local Notifications: Getting Started - RayWenderlich.com
This tutorial is all about local notifications. ... has an error object that indicates if a problem occurred when scheduling a notification.
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