I am making an app in iOS where it will send local notifications on a timer. It works fine when the app is in background state, but does not work when it has been terminated and closed completely.
Is there anyway to still send local notifications when this has happened?
Thanks in advance.
The local notification should occur at the schedule time even if the app is closed.
Notifications could be created at any moment (on Foreground, Background or even when the application is terminated/killed).
Local notifications are scheduled by an app and delivered on the same device. They are suited for apps with time-based behaviors, such as calendar events. When you run your app on a device with Android OS 8.0 or above, Kony uses default channels that are mentioned in the localnotificationconfig.
A Push Notification is sent from a server and it requires internet on your device to receive it.
Sure it is possible, if you schedule a local notification it will fire even if you terminate the app.
UILocalNotification *_localNotification = [[UILocalNotification alloc] init];
_localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:_value];
_localNotification.timeZone = [NSTimeZone defaultTimeZone];
_localNotification.alertBody = @"Beep... Beep... Beep...";
_localNotification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]scheduleLocalNotification:_localNotification];
... works like a charm for me.
The local notification can be delivered when the app is terminated or closed, but they must be scheduled when the app is running. You can set the fireDate
for a notification in the future, schedule it, and it will be delivered whether or not the app is running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With