I am writing a Xamarin application that needs to download and upload data on a schedule.
Currently the task is working fine on Android by using the Android Foreground Service along with the Notification Manager. https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/services/foreground-services
BUT in IOS...
I can't figure out how to get a background service to stay running on a schedule (every 10 minutes) when the application is pushed to the background or the screen is off.
https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/backgrounding/ios-backgrounding-techniques/
I can't use the Background Fetch because it runs when it feels like running and I need to run on a strict 10 minute schedule.
I can't use the Background Transfer Service because it only "starts" by the Background Fetch which is back to not running every 10 minutes.
I can't use the Remote Notifications because the app is doing the "push" to the service and not the other way around.
Since I am gathering GPS data, I tried to use the IOS GPS Location Manager Service but that only works if the device physically moves inside a 10 minute window and some of the devices do not move every 10 minutes YET we still want data from the device.
I tried to use a Background Task with the Expiration Handler but it dies after 5 minutes.
https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/backgrounding/ios-backgrounding-techniques/ios-backgrounding-with-tasks
Any suggestions are greatly appreciated.
Copyright Notice:Content Author:「goroth」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/57282162/xamarin-ios-background-task-on-a-schedule