Capacitor: LocalNotifications: add second option to on pattern

Created on 18 Jun 2019  路  11Comments  路  Source: ionic-team/capacitor

The following code triggers a local notification, every day at 22:55

        schedule: {
          on: {
            hour: 22,
            minute: 55
          }
        }

The problem is this that when the user receives the notification at 22:55:00 and he immediately taps on it, he gets another notification, because the on pattern matches the time during 22:55:00 and 22:55:59. If the user is fast with tapping he receives multiple notifications during that minutes.

I think this behavior is not wrong, because the pattern matches the time. But I think we need a way to also specify the seconds. This would solve the problem and the notification only appears once a day.

        schedule: {
          on: {
            hour: 22,
            minute: 55
            second: 0
          }
        }
bug android

All 11 comments

in which platform are you testing?

Sorry, forgot to mention. It's on Android 9 (Tested in an emulator and on a device)
It's okay, notification appears only once, on iOS.

I also did a test with day

schedule: {
  on: {
    day: 18
   }
 }

Assuming you run this on the 18th of a month, on Android you immediately get a notification and each time you tap on the message a new notification pops up.
On iOS you don't get a notification. I assume you get one when the day changes from 17 to 18.

I have the same issue on Android 9

We also have the exact same problem. Adding a second option should be the way to go - which shouldn't be too hard to implement I guess.

@ralscha Since your post is already a few months old, did you find a workaround for this?

No I haven't. I was just exploring the capabilities at that time.

Any update on this? I am also experiencing this behavior in Android. I expected that adding the count prop and setting it to 1 would remedy this, but it did not help. I just kept getting the notification after swiping it away

{
  count: 1,
  schedule: {
    on: {
      day: 18
    }
  }
}

this still triggers the notification multiple times. Anybody know what the count is supposed to do?

any update on this?

The Cordova project had a similar bug that was fixed in their latest beta: https://github.com/katzer/cordova-plugin-local-notifications/pull/1813

@mrowe009 Count is for every; if you specify every: day and count: 2, it will repeat every 2 days.

I'm having the same issue. I tried passing in second anyway since the Android code looks like it doesn't care, but that did nothing. This makes on completely useless.

no documentation on how to do please ...capacitor team replay on this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stripathix picture stripathix  路  3Comments

MatanYadaev picture MatanYadaev  路  3Comments

gnesher picture gnesher  路  3Comments

danielsogl picture danielsogl  路  3Comments

nicobytes picture nicobytes  路  3Comments