Xamarin IOS background task on a schedule
NickName:goroth Ask DateTime:2019-07-31T09:59:07

Xamarin IOS background task on a schedule

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

More about “Xamarin IOS background task on a schedule” related questions

Xamarin IOS background task on a schedule

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 Notific...

Show Detail

Xamarin iOS Background task

I am working at a Xamarin Forms app and I am trying to make a background task for iOS. Works only the first time when i'm deploying on the phone. After that when i lock the phone nothing happens. H...

Show Detail

How to run a task in background at a fixed time in xamarin ios?

I am working in xamarin ios. In my app I want to run a task in background at a fixed time. Means I want to run the background task at 12:00 PM (in afternoon) everyday only if app is in idle in back...

Show Detail

Xamarin iOS background upload task (iOS 7) - DidFinishEventsForBackgroundSession

From what I understand from the documentation DidFinishEventsForBackgroundSession is supposed to be called when the task completes (the transfer completes) I have a progress bar that updates based...

Show Detail

Xamarin background task when connectivity changes

Im working on a project which requires me to do some uploading when the connectivity changes. Im a writing an android and iOS app using Xamarin. I know in iOS there are huge restrictions using back...

Show Detail

How do I schedule the launch of an application or task in Xamarin ios from the background?

Here's what works well on android /// this will schedule the startup from the background Intent intent = new Intent(Android.App.Application.Context, typeof(AlarmHandler)); PendingIntent pendingInte...

Show Detail

Xamarin.iOS PostAsync on Background

I send a request to api with Xamarin.Forms/Xamarin.iOS app. But When I put the application in the background without an answer from api, PostAsync throws these error: System.Threading.Tasks.

Show Detail

background task working permanently in Xamarin iOS

I am currently facing a problem. I am working on an mobile app made with Xamarin for Android and iOS. The app must work permanently even in background. But in the iOS version, the app is killed aft...

Show Detail

How to run a task in background for every 5 minutes in xamarin ios in visual studio

I am working on xamarin forms cross platform application which supports both android and iOS, in this i need run a background task for every 5 minutes for iOS version. How to Achieve this, can any...

Show Detail

Schedule notification in background task

I'm developing a Calendar/Alarm app for iOS which is synchronising with a web server. When an activity is added on the server, a push notification is sent out so that the iOS client can fetch the new

Show Detail