0

Problem:

  1. I have an old Android 4 phone which I want to give to my child so that:
  • he can call me when needed from school
  • I could track his location if needed
  1. for location tracking I would be happy with Google maps built-in option BUT it is not available for Android 4 anymore due to its 'planned obsolence' !!!

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 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!

alex
  • 11
  • 3

1 Answers1

0

Option 2 seems to be a finer way to implement and control it, But you will still end up losing battery when the GPS is left on.

Also would suggest you to look into this, There was an open bug on Android through which you can leverage the functionality of controlling GPS you wanted, That will work only if you are not on a patched version of the OS.

Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52