Steffaan / cordova-plugin-local-notifications

Cordova Local Notifications Plugin
Apache License 2.0
31 stars 38 forks source link

Repeated notifications problem #8

Open mschristo opened 5 years ago

mschristo commented 5 years ago

Repeated notifications are not working as expected

Your Environment

Expected Behavior

Schedule a notification to trigger every time the date time match

Actual Behavior

The notification is triggered in the right time but it shows up multiple times at the same minutes and the app crashes

Steps to Reproduce

I set this:

cordova.plugins.notification.local.schedule({
            title: 'Happy Birthday!!!',
            trigger: { every: { month: 1, day: 17, hour: 12, minute: 20 } }
        });

Context

What were you trying to do?

Debug logs

01-17 12:20:01.099 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.100 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.150 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.150 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.193 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.193 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.233 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.233 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.268 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.268 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.297 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.297 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.326 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.326 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.354 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.354 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.381 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.381 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.416 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.416 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.442 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.442 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.475 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.475 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.513 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.513 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.560 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.561 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.594 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.595 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.626 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.626 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.653 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.653 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.680 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.681 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.717 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.717 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.727   690   690 E VibratorService: Setting amplitude  to: 3596
01-17 12:20:01.749 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.749 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.775 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.775 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.804 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.804 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.834 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.834 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.860 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.861 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.894 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.894 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.923 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.923 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
01-17 12:20:01.952 29262 29262 W Notification: Use of stream types is deprecated for operations other than volume control
01-17 12:20:01.952 29262 29262 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
coleweusthem commented 5 years ago

I'm having the same issue, if you find a solution or workaround could you please share?

robertfriston commented 5 years ago

I also have similar issue, just want a repeating notification 'every day' (at whatever time) - works on IOS but not on Android

Steffaan commented 5 years ago

@mschristo @coleweusthem I'm trying to reproduce this but I can't manage to reproduce it with the given example in this issue.

I used the exact same code as mentioned, only changed the day to the current date and see the following in the adb logs: image

Notification gets triggered only once (which is correct) and the logs show that the next trigger will be in 2020, which is also correct.

Uninstall your app completely and try a fresh install. This will wipe any notification channels created earlier (from the original plugin). Since this fork supports mulitple channels you can create your own channels, so try to define a channel in your notification too while your at it.

@robertfriston Could you provide your JS code so I can test it as well? Perhaps I can reproduce the error with your code.

mschristo commented 5 years ago

Hello @Steffaan,

thank you for your answer but i still having troubles making this works. Can you please share your project that this functions works (i assume it's an example code project). Also i cannot see the "next trigger..." log in my logcat

Steffaan commented 5 years ago

@mschristo

Sure, it's an empty cordova project where I added the plugin and your code snippet

https://ufile.io/binhc

(don't forget to change the time of the notification)

mschristo commented 5 years ago

In your cordova project it's running as expected. But in my ionic project it did not. Here is my project in case you want to take a look:

https://ufile.io/m9zmk

When the notification triggers, it runs multiple times until the app crash. Here is a screenshot of this : notifications

gotters commented 5 years ago

In case this helps I have never been able to get "Every" working, not in this fork or the original branch. I manually create my schedule (ie each scheduled task) and then refresh that schedule as time goes by. Still even in Android 8 after the first 1 or 2 notifications (across 1 or 2 days) it stops. I am trying it now in this fork to see if works.

JoueBien commented 2 years ago

Here's the bug report for the same issue from the original source: https://github.com/Steffaan/cordova-plugin-local-notifications

Before people start going on about setting count - I'll say it again adding count does not work (it doesn't get used when every is present) when you have repeats so stop putting it forward as a solution - IT DOES NOT WORK FOR THAT USE CASE.