Local notfication is getting a major problem to me !
let now = new Date().getTime();
let time1=new Date(now+60000);
text: "Biraz kelime çalışalım mı ?",
Local notification is used with backgroundmode plugin .
I got interesting unexpexted behavior.When the phone is awake it works fine .However when the phone is in sleep(locked and blackscreen) ,LocalNotification is sometimes triggered sometimes not but even if it works ,it has a delay from 5 mins to 15 mins.
* Version of Plugin:@ionic-native/local-notifications": "^3.5.0",
*OS :Windows 10
*Lenova A6020a41 Android version 5.1
*Cordova version 6.5
*Installed platforms: android 6.1.2
If needs more information please let me know Thank you in advance
I’m having this issue too.
@techsnake did you ever find a solution?
I’m using local notifications and background mode.
It works fine when the device is awake.
If I lock the screen but keep the screen on (still on the lock screen) it works. But once I let the screen go black it doesn’t send the notification and then randomly it will come through at some point.
These features are something so critical to a lot of applications these days yet they’re so hit and miss.
Nope sorry i couldnt find any solution .
I have found a solution that worked for me it gave me both things I was looking for, a heads up notification and the notifications working when the device is locked and screen is dimmed.
It had one minor drawback in that the device doesnt light up when the notification is received but the sound plays and it works when scheduled. (EDIT: On second look this may be just my phone as it happens with all notifications from any application)
My solution was to uninstall the ionic-native plugin for local notifications and use this fork https://github.com/DavidBriglio/cordova-plugin-local-notifications
Add to your project:
cordova plugin add https://github.com/DavidBriglio/cordova-plugin-local-notifications
Then in the page you’re using local notifications:
Put this up top:
declare var cordova;
i ll try it for the next project thanks for contribution
this is really works for you?
on different types of phones?
I doubt because the github have long time without any updates.
This did really work for me. Heads up notifications were working on iOS. Just not on android. The problem was that the priority attribute was missing from the ionic wrapper. This was since fixed and added in the ionic wrapper. You need to have priority set to 1 to get a heads up notification on android. I haven’t tested the ionic wrapper but I can confirm that the fork I used from the local notifications repository worked for me. I did not use the ionic wrapper.
I have other question, also happen to you that notifications when were opened, were double?
I don’t identify the pattern, but sometimes opened double and sometimes not :S.
The other thing, the notification doesn’t show in exactly time, is displayed in a range within one minute, that it happen to you too?
I modified the plugin code with something that i saw in pulls requests from katzer github, and works, but sounds two times, and the third not, after two times more, and again not, is very strange.
If I dont modify this in plugin, always sounds, but not in exact time .
And i see that works in background mode in android with david briglio’s fork Thanks!!.
However, I should try different phones.