-1

I'm building a reminder-like application that will remind people to take their medication on a scheduled time by firing up a notification to ask the user to open the app for more details about the medication they should take. I'm planning to use local notification instead of push notification, but just wondering if the local notification will still work even if the application is terminated (swipe up in task manager, or in my case I set the app to terminate once home button is clicked).

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
michelle9090
  • 267
  • 1
  • 4
  • 14

2 Answers2

1

Yes, local Notification will work even if your app is terminated. You just need to register a Local Notification with a date on which you want to fire that Notification.

Local Notification will fire on the registered date whether your app is terminated or not.

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
Rajat
  • 10,977
  • 3
  • 38
  • 55
1

Shortest answer : Yes, here is an example how to use local notifications in your app

UILocalNotification* localNotification = [[UILocalNotification alloc] init]; 
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:60];
localNotification.alertBody = @"Your alert message";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification]

the fire date property tills the system when you want to fire the notification even if your app is suspended.

Reference : Appcoda!

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75