Hauk icon indicating copy to clipboard operation
Hauk copied to clipboard

Request Location - Always

Open licaon-kter opened this issue 3 years ago • 6 comments

The current "only when in use" seems to fail as the app forgets to ask for an update on time, be it OEM suspending it (yes I've disabled all the battery stuff) or something else.

licaon-kter avatar Jul 15 '20 09:07 licaon-kter

Hi, thanks for reporting this. Due to a technicality in Android, some background tasks are still considered to be running in the foreground and thus covered by the "in use" option. Hauk uses this functionality, and should therefore be receiving location updates. The same mechanism governs both short and long interval periods, so there is no difference in code between them.

I tried starting a 300 second interval share as you mentioned in #151, but I am unable to reproduce the issue. Would it be possible for you to fetch a log from the phone with e.g. adb logcat if you can reproduce this error? There are ways to work around this, but I would prefer a fix for the underlying problem rather than a workaround for the symptoms.

bilde2910 avatar Jul 30 '20 18:07 bilde2910

Not sure how to repro, I used this a lot a couple of days and at one point location services were marked as active when Hauk was in the background, yet there were not the previous sessions.

I can't rule out OEM messing things up, but this "Always" vs "On use" was the thing that I noticed, not sure it fixes it though.

licaon-kter avatar Jul 30 '20 18:07 licaon-kter

I experienced the same problem recently. When answering the question about permisson to geolocation on my Xiaomi Mi 9 i get asked "No", "Only when using the app" and something else i forgot - but the "Always" is missing. If you like i could go and search another app that is using GPS that has the correct request "Always".

natrius avatar Jul 23 '21 09:07 natrius

@bilde2910 any update on that? Do you need links to other open source GPS tracker to study the code? If that helps, I can look it up for you :)

natrius avatar May 29 '22 17:05 natrius

I'm also seeing this issue, and it does seem that in Android 11 this permission is required even for foreground services per https://developer.android.com/about/versions/oreo/background-location-limits:

Caution: If your app starts a foreground service while running in the background on a device that runs Android 11 (API level 30) or higher, your app cannot access location information unless the user has granted the ACCESS_BACKGROUND_LOCATION permission to your app. For more information, view the guidance about the while-in-use restrictions that are associated with foreground services.

eras avatar Feb 15 '23 08:02 eras