Show alert on sceen when app is in background

I want to show multiple alerts after some time interval when the app is in background.

Currently I am using local notification to show the alert but I cannot detect action when user presses the cancel button of local notification.

  • Add Local Notification in ios10 - swift 3
  • How to repeat local notifications every day at different times
  • Custom repeat interval for UILocalNotification
  • Dismiss an already delivered UILocalNotification?
  • Set multiple UILocalNotification
  • Customizing UILocalNotification's alert
  •  UILocalNotification *localNotif = [[UILocalNotification alloc] init];
    
                if (localNotif == nil)
                    return;
                localNotif.fireDate = [NSDate date];
                localNotif.timeZone = [NSTimeZone defaultTimeZone];
    
                        // Notification details
                        localNotif.alertBody = @"This is local notification message.";
                        // Set the action button
                        localNotif.alertAction = @"View";
                        localNotif.alertAction = @"Yes";
    
                localNotif.soundName = UILocalNotificationDefaultSoundName;
    
                [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
                [localNotif release];
    

    Is there any other way I can show alert on screen when app is in background ?

    2 Solutions Collect From Internet About “Show alert on sceen when app is in background”

    You will not be able to detect if you user decided to ignore your UILocalNotification.
    Since you can not show a UIAlertView in the background your only option is to use UILocalNotification.

    But as you state you can not detect if the user clicked the cancel button, also with iOS6 and the notification center there no longer is a cancel button. Only if user selected to show you notifications as alerts will there be a close button. Still you can not detect that you notification is closed or not views at all.

    Your only option is to keep spamming the use with notification until the app is opened. But it is considered bad user experience and could make you app hated by users.

    this not posible in ios.only using push notification you can display it.