JonDouglas / WorkManagerSample

18 stars 8 forks source link

Trying to use WorkManager with this sample but doesn't works #1

Open jorgegarciax2 opened 5 years ago

jorgegarciax2 commented 5 years ago

Hi, I'm trying to use the nuget package in this example but it doesn't work properly. In the following guide (https://devblogs.microsoft.com/xamarin/getting-started-workmanager/), it is shown how the output log returns results every X minutes. However, in my case the application launches a large number of simultaneous runs/threads and does not launch again despite being configured every 2 minutes. I thought it was an error of my code so I decided to download this project but the result is the same. I'm using Android 9 both in the emulator and in the target version of my project. The expected output should be this: image

The output I get: image

Is it a package failure or am I missing something?

Thank you in advance

jslachta commented 5 years ago

It is not a package failure or an error. It is a feature.

Creates a PeriodicWorkRequest to run periodically once within the flex period of every interval period. See diagram below. Note that flex intervals are ignored for certain OS versions (in particular, API 23). The flex period begins at repeatInterval - flexInterval to the end of the interval. The repeat interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS and the flex interval must be greater than or equal to PeriodicWorkRequest.MIN_PERIODIC_FLEX_MILLIS.

The MinPeriodicFlexMillis is 300000 ms, the MinPeriodicIntervalMillis is 900000 ms.