How do I wake an app up or cause it to run code in the background when it receives a notification, whether local or remote?
How do I wake up an app when it receives a notification?
Add a Comment
How do I wake an app up or cause it to run code in the background when it receives a notification, whether local or remote?
For remote notifications you need to enabled the content-available flag. Then use the completion handler to process it in the background. https://developer.apple.com/documentation/uikit/uiapplicationdelegate#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:fetchCompletionHandler:
Note you only have 30 seconds to process any background tasks.