1

I am coding an app that needs to poll location at specific intervals even when the app is off. I am currently using a Firebase JobDispatcher to get the job done. The code is as follows:

BackgroundJob.schedule({
      jobKey: backgroundJobKey,
      period: 60000,
      exact:true,
      allowWhileIdle:true
    });

My requirements are the following:

1) If phone is charging then the location needs to be polled continuously (which is happening)

2) If phone is stationary at the same location, then app must not poll (which is also happening when the app goes into doze mode)

3) If the phone is kept stationary in a car that is moving (or if the phone is kept stationary in someone's pocket when they are driving a bike), then the location needs to be polled continuously (which is not happening and which is the problem).

How do I get the job-dispatcher to poll when the phone is kept inside a car that is moving?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Thanatos
  • 282
  • 5
  • 18
  • You cant override doze mode in only certain instances. You either always flag the app as white listed (app not effected by doze) or you don't and you get the behavior you see now. If your phone is in doze mode job dispatcher only gets fired when doze says so. – tyczj May 07 '18 at 17:35

0 Answers0