0

I’ve implemented a steps counting feature in my app. I used a JobService which listens to the Sensor.TYPE_STEP_COUNTER events and it is working. I have 2 issues and maybe someone could help: 1) If the app isn’t opened everyday, because of doze mode, it is killed and this stops the JobService from listening to the sensor events – so I can’t continue to count steps. I currently don’t want to “nag” the users, so I don’t want to make them open the app. 2) If the app is opened everyday, the steps are counted perfectly, but the battery alarm is going off. I tried increasing the JobService periodic time and I also tried to use batch reading for the sensor – this didn’t change much battery wise, and it counted less steps than before.

Can anyone help with a solution for any of these issues?

yadit
  • 91
  • 4

1 Answers1

0

i think it may help... In JobScheduler OnStopJob() restart the job Again.. Why because JobScheduler wont work more than 15 min.. You have to restart When it stopped. dont open the activity . just start Scheduler..

satyan_android
  • 364
  • 4
  • 15