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 recurring/repeating notifications

See original GitHub issue

I’ve scheduled local notifications using this library. The notifications repeat every day at a specific time.

But now I want to delete these notifications but couldn’t find any way! This is very surprising that library doesn’t support this out of the box.

I get all notifications and identify which one I want to cancel based on some attribute. Then I call cancelLocalNotificationForId on that notification. I do this operation on app launch.

But the problem is that this only cancels it for that particular day and not all days. How do I cancel for all recurring days?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:29

github_iconTop GitHub Comments

2reactions
mparramontcommented, Jun 28, 2021

@sangolariel I think I had the same problem you’re having. The issue lies in the companion push-notifications-ios library where notifications scheduled for the next day will be scheduled with date = null. Here is a bug report on this repo, the author of the library says it’s a problem with push-notifications-ios. In that repo here is the related bug report. Somebody mentioned to use a deprecated method as a workaround, and it worked great for me.

This is how my notification code looks now:

    if (Platform.OS === 'ios') {
      // using a deprecated method since the current one seems to have a bug:
      // https://github.com/react-native-push-notification-ios/push-notification-ios/issues/247#issuecomment-751282455
      PushNotificationIOS.scheduleLocalNotification({
        fireDate: todayAt9PM.toISOString(),
        alertTitle: title,
        alertBody: message,
        userInfo,
        repeatInterval: 'day'
      })
      storeScheduledNotificationId()
    } else {
      PushNotification.localNotificationSchedule({...})
    }

Let me know if that works for you!

1reaction
cassidypignatellocommented, Jul 19, 2021

@mparramont great idea, thanks for letting me know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Turn Off Repeat Alerts for Unread Messages on ...
Hi guys, In this Video, I will show you 'How to Turn Off Repeat Alerts for Unread Messages on iPhone (iOS 14.6) .'...
Read more >
How to Stop Repeat Notifications on Android? [Answered 2022]
The first is to go to the Notifications settings menu in the app. The second is to go to the Settings menu and...
Read more >
How do I stop repeat notifications? - Microsoft Community
I don't want to turn off notifications but I do want to stop notifications that I have discarded constantly reappearing.
Read more >
Turn off repeat notifications? - Android Central Forums
You can go into "Settings"-> "Notifications". Scroll all the way down until you see "Looking for Something Else" and click on "Notification ......
Read more >
Q: How do you turn off a repeat notification in Find Friends app?
I set a repeat notification for when my wife leaves a certain location. I no longer need this but there is not a...
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