prithvibhola/WorkManager

Location not tracking

Opened this issue · 2 comments

Hello. Thanks for your work.
Just built your project and seems like its not working anymore on the newer versions of Android (8.1 real device, 9.0 emulator). What I've done:

  1. Changed kotlin version in build.gradle: 'kotlin': '1.3.50'
  2. Changed btnTrack.setOnClickListener { getFromLocationWithPermissionCheck() } to btnTrack.setOnClickListener { getFromLocation() } in MainActivity (misstype in the function's name).
  3. Changed track time interval to 10 seconds in MainViewModel: val locationWorker = PeriodicWorkRequestBuilder<TrackLocationWorker>(10, TimeUnit.SECONDS).addTag(LOCATION_WORK_TAG).build() so I could test it properly.

But tracking is not working neither when app is running nor when it's closed (it works only once just after the click on a corresponding button). The status of manager is always "ENQUENUED", and there's only 1 message in the Logcat:
I/WorkerWrapper: Worker result SUCCESS for Work [ id=c9848574-6e01-4d83-917b-5f7590cc8f25, tags={ prithvi.io.workmanager.utility.workmanager.TrackLocationWorker, LOCATION_WORK_TAG } ]
Appreciate any suggestions!

Hello,
I also find the same issue.
Can you please help us to solve this issue?

Your help will be appreciated.

The minimum interval for work manager is 15 minutes, so even if you set it to 10 seconds it does not work
Also, this app needs to request background location access permission for android above 29