Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

How can I reduce power usage and still GET location updates in a location-based Android application? #338

Open
kujaska opened this issue Aug 8, 2023 · 0 comments

Comments

@kujaska
Copy link

kujaska commented Aug 8, 2023

I tried this Google example code - https://github.com/android/location-samples/tree/master/ForegroundLocationUpdates:

  • it works fine with default settings:

priority = LocationRequest.PRIORITY_HIGH_ACCURACY

but it keeps my Android 5 phone WARM and will DRAIN its battery in ~ 8 hours

  • if I opt to:

priority = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY

then I never get updated location but only the old location.

Should I implement some auto-job e.g. with workmanager
https://developer.android.com/topic/libraries/architecture/workmanager
which will let's say 3-4 times per hour:

  • switch on LocationRequest with PRIORITY_HIGH_ACCURACY
  • get updated location
  • switch off LocationRequest till next scheduled time?

Or is there any other better solution?

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant