AndroidSupportComponents icon indicating copy to clipboard operation
AndroidSupportComponents copied to clipboard

PeriodicWorkRequest not running as expected

Open jrahma opened this issue 6 years ago • 4 comments

Hi,

In the attached sample, I have created a PeriodicWorkRequest to be running every 30 minutes

I have logged the DoWork in my AppCenter Analytics and I am getting the DoWork when I start the app but not every 30 minutes. For example, today I started the app and I got the DoWork logged but after that and until now (more than 2 hours) nothing is logged.

AppCenter

LocalNotifications.zip

Thanks, Jassim

jrahma avatar Aug 25 '19 15:08 jrahma

This is a function of the Android operating system. The time you specify is a minimum. The OS decides when to exec your task. All part of better battery management etc.

ndastur avatar Sep 12 '19 20:09 ndastur

@ndastur How?!

it's called background worker which means it should run in the background not just when I open the app

jrahma avatar Sep 13 '19 07:09 jrahma

@jrahma just trying to be helpful. It does work in the background. Read the Android documentation and you'll get a better understanding of how Android does background work now. It might help to post some of your sample code. Without that, we don't know how you have implemented the Worker. I can let you know that I have successfully set up periodic tasks in Xamarin and it works as expected.

ndastur avatar Sep 13 '19 09:09 ndastur

@ndastur sample was already attached in my issue

jrahma avatar Sep 13 '19 10:09 jrahma