Reputation: 491
I need to bring application to foreground programatically from background when the device receives a notification (without user interactions).
Whenever a notification occurs, I'm able to parse the data using
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {}
but unable to load UI.
How can I bring app to foreground?
By the way, I have enabled "Background mode" and checked "remote notifications" in xcode.
Upvotes: 1
Views: 2670
Reputation: 82759
It cannot be possible without user interaction ,
you can sent the APNS to device to tell the user to bring the application to foreground, if user interact that you can proceed further procedure
Upvotes: 1
Reputation: 119031
You can't. You can only send the user a notification to ask if they want to open the app (or answer a question asked by the notification without even bothering to open the app).
Upvotes: 3
Reputation: 134
after user click on Notification it will take user to foregrond otherwise you cannot go to foreground directly
Upvotes: 1