'Xamarin NSTime RepeatingScheduledTimer is not getting called on Release Mode - Backgroud

In my application, I have created NSTimer event that gets triggered every 5 minutes, nevertheless, it's in the background or foreground. The application will check for local content in DB & check if it is required to Sync. The applications work as expected in debug mode, on both simulator & device.

However, when I create a Release build, the NSTimer task, stops the firing task in the background. Would like to know the cause of this behavior in Xamarin.IOS?



Solution 1:[1]

NSTimer is not allowed to run in background if you do not enable any background mode , the system will suspend your app shortly after it moves to the background.

However there are several options for refreshing content in the background

  • Region Monitoring and Significant Location Changes Service

  • Background Fetch (iOS 7+)

  • Remote Notifications (iOS 7+)

Refer to

https://developer.apple.com/forums/thread/127444

https://docs.microsoft.com/en-us/xamarin/ios/app-fundamentals/backgrounding/ios-backgrounding-techniques/updating-an-application-in-the-background

  • Remote Notifications (iOS 7+)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ColeX - MSFT