cordova-plugin-local-notifications
cordova-plugin-local-notifications copied to clipboard
Repeated notifications problem
Repeated notifications are not working as expected
Your Environment
- Plugin version: 0.9.2
- Platform: Android
- OS version: 8
- Device manufacturer / model: Pixel XL3
- Cordova version (
cordova -v
): 8.0.0 - Cordova platform version (
cordova platform ls
): 7.1.2 - Plugin config: Installed by cli as described on README
- Ionic Version (if using Ionic) 3
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
- Android: $ adb logcat
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
I'm having the same issue, if you find a solution or workaround could you please share?
I also have similar issue, just want a repeating notification 'every day' (at whatever time) - works on IOS but not on Android
@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:
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.
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
@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)
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 :
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.
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.