0

There is a way to detect when a localnotification is fire?? For example i have one notification that is fire 12:00 a.m it show the notification there is way to know if the user touch the notification. Because if the user no touch the notification i want to set other alarm to fire at 20 minutes after if it not touch the notification when is fire.

Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70

2 Answers2

2

Call -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification in the app delegate to know when the user returns to the app from a notification. Note: this is only called if the application was not closed, i.e. closed via multi-tasking. I'd suggest setting a timer for 12:00AM to set another notifcation and if the user returns to the application from the first notification then cancel the second one.

Milo
  • 5,041
  • 7
  • 33
  • 59
  • 1
    Exactly, set 2 local notifications, first at the desired date and the second one at the date of the first one + 20 minutes (or whatever interval you want). Then if the first one fires, cancel the second one. If it doesn't fire, the 2nd one will be shown. – Alex Feb 19 '16 at 14:24
0

while application in forground or background then this method call when fire notification in appDelgate

-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{

}

if application close then click on notification then didFinishLaunchingWithOptions method check is local notification

if ([[launchOptions allKeys] UIApplicationLaunchOptionsLocalNotificationKey]) {


    }
nitin kachhadiya
  • 959
  • 2
  • 9
  • 21