My application uses remote silent notification to wake up the app and send device location to the server. Prior to iOS 13, it was working perfectly. With iOS 13, my service is suspended when the app is in the background or inactive. I do not want to use the new BackgroundTasks API as the system decides when to execute it. Is there any way to send data to server when a silent notification is received and the app is not active?
ios13 send data to server when app is in background or inactive
Is there any way to send data to server when a silent notification is received and the app is not active?
When the notification is delivered to your app, the system will resume your app in the background. At this point your app only has a few seconds of background execution time, not nearly enough to complete a network request. If you need more, use a
UIApplication
background task. Currently that gives you 30 seconds, which should be enough for a simple network request.
For more info on
UIApplication
background tasks, see
UIApplication Background Task Notes.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"