In our app users can track and submit journeys they have recorded. I need a simple way of creating a task in iOS. I have already created and tested this on Android. It works via:
- The user selects the journeys they would like to submit.
- Taps sync and a foreground service is created that syncs the journeys to our API.
- This service will continue to sync journeys even if the app is put into the background or even closed.
So in short how can i achieve this on iOS 9-13?
I have already tried creating a background-safe tasks using:
nint taskID = UIApplication.SharedApplication.BeginBackgroundTask( () => {});
However, this only gives the task 2 mins to run which isn't enough. I have looked into the NSURlSessions but they require URls, whereas we are using our own API wrapper.
I would simply like a way of creating a task when the user taps 'sync' and this task also being capable to run in the background. I am not too bothered if the task is cancelled when the app is closed, although if possible would like the task to continue.
Thanks.