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.
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 ?
- Getting local notifications to show while app is in foreground Swift 3
- Fire a notification at a specific day and time every week
- non-main bundle file as alert sound
- application:didReceiveLocalNotification never called on ios 8
- Delete a particular local notification
- How can I schedule local notification for the following scenario?
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
Since you can not show a
UIAlertView in the background your only option is to use
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.
- Resize UIView While It Is Rotated with Transform
- UILabel Align Text to center
- How to capitalize first word in every sentence with Swift
- Unable to decrypt data encoded via OpenSSL on iPhone
- Xcode Instrument : Memory Terms Live Bytes and Overall Bytes (Real Memory) confusion
- What does the warning / exclamation mark next to prerelease builds mean?
- UIVisualEffectView renders differently on different devices
- How can I save a JSON response to a file that would be accessible from within a local HTML file loaded inside UIWebWiew
- xamarin.ios implement PageController with images only code
- Getting Exception: “Impossible to set up layout with view hierarchy unprepared for constraint”
- How to Merge PDF file with Annotation
- Releasing instances of NSNumber created with initWithInteger: vs. numberWithInt:
- Problem with Drag-Drop from NSTableView to Finder
- Insert new row in UITableView when tapping first row
- Error getting valueForKey in an NSDictionary for key containing @ character