mirror of
https://github.com/seemoo-lab/AirGuard.git
synced 2026-04-25 15:35:49 +03:00
[GH-ISSUE #97] Android background location limits prevent location from being retrieved #65
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AirGuard#65
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lbdroid on GitHub (Jan 10, 2023).
Original GitHub issue: https://github.com/seemoo-lab/AirGuard/issues/97
Since AOSP 8, there are limitations placed on background location access for the supposed purpose of reducing battery consumption.
https://developer.android.com/about/versions/oreo/background-location-limits
In practice, background location access is very severely reduced to about 2-3 times per hour.
The easiest way to work around this limitation is to create a foreground service (see link above).
Power consumption on location access can be reduced by only requesting location after a tracking device is already detected. The current process in ScanBluetoothWorker is that first it begins a location request, THEN it begins scanning for trackers, and then it waits for the location request to complete and puts them together. I would propose that it first scans for trackers, then ONLY IF a tracker is detected, begin and wait for a location.
@lbdroid commented on GitHub (Jan 10, 2023):
Create basic foreground service like this (also adding the service to AndroidManifest.xml);
Add this near the end of TrackingDetectorWorker.doWork():
And rejigging ScanBluetoothWorker.doWork():
The above makes location acquisition work infinitely better.
The service doesn't have to do anything at all besides just sit there in the foreground in order to escape from the background location rate restrictions. The rejigging of ScanBluetoothWorker just avoids wasting power on finding a location if no bluetooth device was detected.
@Sn0wfreezeDev commented on GitHub (Jan 23, 2023):
Hi,
Yes we fixed this issue in the next version. Stay tuned for the update 😊
@jayb-g commented on GitHub (Oct 14, 2024):
Also, support for opencellid key can be added to have more frequent location data but not GPS based, so to save battery
@Sn0wfreezeDev commented on GitHub (Oct 14, 2024):
How would that be implemented? Is that part of Android's location access API?
@jayb-g commented on GitHub (Oct 14, 2024):
No, I meant instead of the app getting location data only from GPS, it could also additionally/alternatively get location from opencellid api(if user has set an api key for it in the settings). Similar to how Find My Device(FMD) does it. Check screenshots.
@jayb-g commented on GitHub (Nov 25, 2024):
@Sn0wfreezeDev
I meant yes, it is part of Android's location access API but cell location would work only if user has GMS. For non-GMS users, having an option to use a third party like opencellid would be ideal.