Closed PareshSolankiMI closed 6 years ago
The template is there for a reason. You have not stated which plugin you are using, which OS you are using, which target OS you use, what the code looks like, any error messages, what you have tried and done. You need to help other people help you.
My system information:
Cordova CLI: 6.5.0
Gulp version: CLI version 3.9.1
Gulp local:
Ionic CLI Version: 2.0.0-beta.11
Ionic App Lib Version: 2.0.0-beta.5
ios-deploy version: 1.9.2
ios-sim version: 6.1.2
OS: Mac OS X El Capitan
Node Version: v5.11.1
Xcode version: Xcode 9.2 Build version 9C40b
We have used master branch of cordova-plugin-local-notifications plugin and the last commit in it is ee7432f44c08ef2ca972cfb3375d6f7991cfad08.
@PareshSolankiMI The native OS is responsible for triggering the notification. The plugin isn't doing it itself. Under the hood it also depends on the system you are talking. But in general if the system like Android decides to trigger the notification like 5 mins later than requested because its busy then that can happen.
There's still no information about how you are trying to trigger the code, whether any of this has worked in the past, how far in the future the schedule is, what OS the code is running on, is this on real code or an emulator. Has this ever worked? What the code looks like?
@rwillett
Here is my code for triggering local notification
let noti = { badge: 0, data: {}, id: 160, title: "TEST", text: "MESSAGE", every:"day", at: TIMESTAMP, sound: "res://platform_default" } LocalNotifications.schedule(noti)
We are running this app in IOS-11/IOS-10 os and also we are testing in devices not in an emulator.
Yes, it works sometimes when we receive notification but the issue is we don't receive it all the time as per schedules.
The template is there for a reason, use it. It saves people having to go back and forwards through the comments trying to work out what versions are doing what.
Don't use at: and every: together in IOS 10 with the new plugin, they don't work together. They used to but not any more.
Your trigger logic is wrong. You need to put the at: inside a trigger.
We still put all scheduled notifications inside an array even if there is only one of them.
Not sure if badges work.
Not sure if sound works.
No idea if your TIMESTAMP works. Whats the code to created it?
Here's working production code to create a dummy notification. Its come straight from our code. GetNotificationIdAndIncrement() simply returns a unique number.
This creates four notifications 5 secs, 90 secs, 180 secs and 300 secs into the future. We use it for testing reminders to pay the Congestion Charge in London. Works and is used every day for testing purposes.
var reminder0 = new Date(now + 5 * 1000);
var reminder1 = new Date(now + 90 * 1000);
var reminder2 = new Date(now + 180 * 1000);
var reminder3 = new Date(now + 300 * 1000);
var original_schedule_time0 = reminder0.getTime();
var original_schedule_time1 = reminder1.getTime();
var original_schedule_time2 = reminder2.getTime();
var original_schedule_time3 = reminder3.getTime();
var notifications = [ { id: GetNotificationIdAndIncrement() ,
sound: "" , // Turn the sound off
trigger: { at: reminder0 } ,
data: { type: "CongestionChargeNotification" ,
original_schedule_time: original_schedule_time0 ,
reminder_type: "reminder0_congestion_charge" ,
order: 1} ,
smallIcon: "res://pw_notification.png" ,
text: "You've crossed into the Congestion Zone and might need to pay. You'll get more reminders later today."
} ,
{ id: GetNotificationIdAndIncrement() ,
sound: "" , // Turn the sound off
trigger: { at: reminder1 } ,
data: { type: "CongestionChargeNotification" ,
original_schedule_time: original_schedule_time1 ,
reminder_type: "reminder1_congestion_charge" ,
order: 2} ,
smallIcon: "res://pw_notification.png" ,
text: "Reminder 1 - Don't forget to pay the Congestion Charge before midnight."
} ,
{ id: GetNotificationIdAndIncrement() ,
sound: "" , // Turn the sound off
trigger: { at: reminder2 } ,
data: { type: "CongestionChargeNotification" ,
original_schedule_time: original_schedule_time2 ,
reminder_type: "reminder2_congestion_charge" ,
order: 3} ,
smallIcon: "res://pw_notification.png" ,
text: "Reminder 2 - Don't forget to pay the Congestion Charge before midnight."
} ,
{ id: GetNotificationIdAndIncrement() ,
sound: "" , // Turn the sound off
trigger: { at: reminder3 } ,
data: { type: "CongestionChargeNotification" ,
original_schedule_time: original_schedule_time3 ,
reminder_type: "reminder3_congestion_charge" ,
order: 4} ,
smallIcon: "res://pw_notification.png" ,
text: "Final Reminder - Don't forget to pay the Congestion Charge before midnight."
}];
cordova.plugins.notification.local.schedule(notifications , function () {
if (debugSetupCongestionNotificationReminders)
ConsoleLog("SetupCongestionNotificationReminders: schedule callback OK");
Break down your code, pull out the stuff thats not needed build slowly and test often,
Rob
@rwillett Thanks for the replay.
Is there any limit for triggering local notification per app in iOS?
I think there is a limit of 64 notifications per app.
In answer to your next questions, see here https://github.com/katzer/cordova-plugin-local-notifications/issues/1525
Hi There,
We are thankful to you for providing this plugin. We are using this plugin since 1.5 years.
Recently, we noticed an issue which is related to the local notification. Please find the details below:
Issue: The issue is we are not receiving the local notification as scheduled every time.
Issue description: In our app, we are setting up the schedules/local notifications on particular time Daily, Weekly, Monthly and Yearly. It should send notification at scheduled time but recently, we noticed that at some extend it doesn't send notification.
We are not able to find particular case in which we face this. Can it be because we don't open the app for a long time? or can it be because of other reason?
Its uneven that we are not able to find the exact case in which it doesn't send notification. We debugged whole code but couldn't find anything.
Can you please help us with this? Any help in fixing this issue would be appreciated.
Thanks,