[Android] Unable to get GPS location on Pixel 6 without opening other map application #1853
Labels
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#1853
Loading…
Add table
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?
Device: Pixel 6
OS: GrapheneOS (January Update), tried both Organic Maps in a profile with Google Play Services and without.
Organic Maps version: Latest available - tested both F-Droid version and Google Play version
Issue:
Whenever I open up Organic Maps outside, I cannot get a location lock. I give it 30 min and I still get no location. If I open up another map application, in this case OSMand, I get my location immeaditely. If I go back to Organic Maps, it now also has my location shown in the app. It seems like Organic Maps cannot get my location on its own.
Regarding the OS. I have used Organic Maps on a Pixel 2 XL with Graphene OS - and there it worked flawlessly (both with and without Google Play Services). There seems to be an issue with Pixel 6 and Organic Maps.
That's an important issue, thanks for reporting it here. Can you please enable logs in the app's settings, reproduce it again, and share logs with us via ? -> Report a bug? Maybe we'll see something suspicious there.
Otherwise, it makes sense to check how Osmand handles location and see what is missing in our implementation.
CC @rtsisyk
Thanks for the quick reply. Please find the attached logs. One log generated when I had OSMand running and received a location in Organic Maps, and one when I didn't have OSMand running and did not receive a location in Organic Maps.
Strange, there is the same issue in both logs. The location is not retrieved. Did you press a blue "location" arrow in the app to activate GPS?
Can you please also try to install a debug apk from this link (unzip it first), and reproduce the issue again (with enabled logs)? https://github.com/organicmaps/organicmaps/suites/4947680512/artifacts/143441241
Yes, I did click on the button to locate me. It has the correct permissions set too.
I did try the same with your debug APK now.
Opened up Organic Maps, clicked on the button to find my location. It could not find me. Then I opened OSMand, got a location in OSMand for a while. Switched back to Organic Maps and got my location there. I then closed down OSMand and returned to Organic Maps. The blue arrow indicating my
position went a bit dimmer after this (as if it's only showing my last known location - this happened on the production APK too).
Adding another observation. When I open Organic Maps, I get the Location indicator from Android 12, with the green dot visible. This green dot disappears after a few seconds. Almost like the app is no longer requesting a location from the OS any longer. It stays lit on OSMand. I did record a screen capture that I could send to you in a PM if it would be helpful.
Edit: Seems like that green dot is not captured by screen recording.
Edit 2: It seems like the dot indicator is only active for 5 seconds on Organic Maps. When I click on the location button, I get the green dot, but only for 5 seconds. If I do the same in OSMand, this stays active until I find a location. Maybe this is why it's not working - as the Pixel 6 has quite a poorer GPS HW (as I understood it) compared to my old Pixel 2XL. So the Pixel 6 requires more than 5 seconds to obtain a location, but Organic Maps seems to stop queriying for this after 5 seconds.
It's not poorer GPS hardware but it's not as well integrated with A-GPS and satellite almanacs as the Qualcomm implementation. Pixel 6 geolocation takes a bit longer especially the first time it gets set up after boot due to the Broadcom software not being as good as the Qualcomm software. They'll probably need to build better software for it. It seems that Organic Maps has a major issue with the geolocation API usage though.
GPSTest and OsmAnd are working fine but a lot of users are reporting issues with Organic Maps unless they run one of those other apps to get the location lock for Organic Maps.
Stock OS has network-based geolocation to get an initial estimate but since Organic Maps isn't using the API well, it won't actually be getting a GPS lock even on the stock OS. It will only be a Wi-Fi / cellular tower / Bluetooth device based estimate. You're just seeing the symptoms much more directly on GrapheneOS since the GPS lock is required to get anything from the OS location API. We'll be offering supplementary location services in the future but it would just be masking this issue and making it a bit harder to notice.
I think this issue could really be tied to Android 12 and people just aren't noticing it nearly as much on Qualcomm devices and also on the stock OS where you quickly get results from the network-based location service and you could use it without ever realizing you're never actually getting a GPS lock.
We've been working on improving our sandboxed Google Play compatibility layer and we ran into something similar where we thought we'd fully fixed the option to use the Play geolocation services but we'd only actually fixed the network-based geolocation services. It's just hard to tell that you're only getting the network-based geolocation rather than GPS in a city. Network-based geolocation by itself is often extremely accurate in cities. It's not an actual substitute for GPS though.
Not directly related but we intend on landing substantial improvements for sandboxed Google Play soon including redirecting apps to the OS location service by default along with having the option to toggle off redirection and grant the Location permission to sandboxed Play services if you actually want to use their location services. Our OS location services do work fine already just like AOSP but we need this redirection option to deal with apps which always use the Play services API when available (or only know how to use it). We also want to support all the fancier features they have if users actually go out of the way to disable redirection and grant Play services access to Location. It's currently partially possible to do that but it doesn't fully work yet. As far as I know Organic Maps only uses the OS API so this shouldn't be an issue at all. It's only relevant to apps which use the Play services SDK either exclusively or as a replacement for the OS API when it's present. We'll have those improvements shipped soon which will help out with a lot of Play Store apps but this Organic Maps issue does not seem at all related since it doesn't use Play.
Having the same issue on Pixel 6 Pro with OrganicMaps. Temp fix is to open OsmAnd first then OrganicMaps. Using it on GOS without Google Play Services.
@thestinger, Organic Maps uses Google Play Location API (
FusedLocationProviderClient
) for Google Play builds andandroid.location
for F-Droid builds. We can try to switch toandroid.location
in Google builds also, but I can't confirm or deny that it works in the same way as FusedLocationProviderClient. Do you know anything about it?I tested Organic Maps/OSMAnd/GPSTest on a Pixel 4a device with CalyxOS 3.10 (Android 12) installed.
For each test, I enabled Airplane Mode, disabled Wi-Fi and did the cold reboot before running any apps. Neither Organic Maps, nor OSMAnd, nor GPSTest were able to acquire GPS in ~10 minutes. GPS Test reported about 36 satellites on the horizon, but was unable to get "3D Fix". I didn't note any correlation between order of running Organic Maps / OSMAnd / GPSTest in this test. A Samsung device with Google firmware was able to acquire GPS just after 2 min.
After this test, I enabled Wi-Fi, I triggered A-GPS update via GPS Test, waited for an hour or so and repeated the same test. Now all three apps were able to get GPS just in 2 minutes. It looks like that the A-GPS actually helps, OR I just wasn't patient enough and the device already received some data from satellites during the first test.
I inspected OSMAnd code and haven't found any major differences between our and their implementation. We use the same API in the same manner, both for GMS (Google Play) and non-GMS cases (F-Droid). OSMAnd, however, also triggers A-GPS update automatically every 16 hours. I implemented similar feature in Organic Maps - organicmaps/organicmaps#2032. This patch should remove needs of GPS Test app, to trigger A-GPS data updates.
One more PR I sent is to make Organic Maps less picky when working with location providers by using system non-GMS API (F-Droid) - organicmaps/organicmaps#2031. It sounds weird, but Organic Maps entirely ignored "FUSED" and "PASSIVE" network providers in F-Droid builds. I have absolutely no idea why. I guess that microG populates "fused" location from Dejavu/Mozilla location services. At least, I can see some data from "fused" provider on CalyxOS. Please correct me if I am wrong.
The last, but not least. Organic Maps doesn't use location in the background. If you switch to another app or lock your phone - Organic Maps immediately stops using location APIs and Android turns off GPS if no other apps use it. This part is strictly checked by Google Play reviewers - the app must not call any location API in the background without having special permission. As a result, you may that running, say, Google Maps navigation can improve location quality for all apps in the system. We plan to get the background location permission for navigation as soon as we get it actually working in the background.
It doesn't need to request background location access. You can make a foreground service marked as a location service with a button to stop fetching location. It's enforced by the permission system either way rather than simply review.
Yes, a foreground service is exactly what we want to do.
Let me summarize all location issues we found during working on this ticket:
Non-GMS builds entirely ignored any location providers except "gps" and "network". "fused" location (Mozilla Location, Dejavu Location, etc.) was ignored. I haven't found any reasonable explanation for this decision in the git history. A fix has been committed by (#2031)
Organic Maps didn't update A-GPS data periodically as OSMAnd does. It looks like that having the latest A-GPS database also helps with the cold start of GPS in purely offline mode. At least I can see the huge improvement in the time-to-fix on Pixel 4a device with CalyxOS. This new feature has been added by (#2032).
Organic Maps doesn't use location in the background. If you switch to another app or lock your phone - Organic Maps immediately stops using location APIs and Android turns off GPS if no other apps use it. As a result, GPS can't fix if you don't keep the app in the foreground. All other location apps just keep GPS running in this case.
I have also made a series of patches to refactor location implementation and make it more error prone (#2087) (#2089) (#2127) (#2093).
Please wait for the next (March) F-Droid update.
Thank you for checking on it. Looking forward to test the new build on my Pixel 6 Pro
Thanks a lot. Will test the March update.
March is about to end. Any news on the update for Pixel 6 owners?
This issue seemed to have been fixed by the latest Android update for Pixel 6 in beginning of March. Before the Organic Maps march update even came out.
I just retested with my Pixel 6 Pro on latest GOS after reading your comment and the problem still persisted.
Organic Maps still stop scanning after 1 or 2 seconds (green light indicator for GPS shut off). Opening OsmAnd still gets a lock within 5 to 6 seconds and after it's locked by OsmAnd, I reopened Organic Maps and I got the GPS lock.
In short, nothing changes for me.
@githupper did you test with the latest OM version?
Yup. I saw the changelog for the latest version and did not see any mention regarding Pixel 6 hence I asked what is the status.
Version I'm using is from 23rd March.
Would I be correct to say I'm the only Pixel 6 Pro owner who is having this issue?
For clarity, I'm using Pixel 6 Pro not Pixel 6 but the problem affects both Pixel 6 and Pixel 6 Pro from the beginning.
Do you have a power-saving mode enabled?
Hi. Power saving is not enabled.
Since my last update on 30th March, I have uninstalled Organic Maps while pending for a fix.
I saw your message notification and have reinstalled the Organic Maps to test again.
This time I was able to get a fix. I'm unsure if it's due to the uninstallation of which it erase the app data or the 2 new Pixel Pro update from GOS since.
As of right now, I confirmed that I'm able to get a GPS fix and Organic Maps is working.
Thank you for the follow up on this issue. Appreciate the help and effort.
Does this issue reproduce for someone else on the latest version? @thestinger
Pixel 6 GNSS support has substantially improved but it did still work before (just more slowly) and I don't think the Organic Maps issue is fixed. We still get lots of reports of it not working properly. It only seems to actually trigger location updates for a few seconds. It may consider trying to fetch a new location but it's not actually requesting it. I don't know what's wrong with it since I'm unfamiliar with your codebase and don't really have the time/energy to try and figure it out. We recently overhauled our opt-in geotagging for our own Camera app because it had a similar issue and it wasn't really working.
GrapheneOS Camera had an experimental opt-in geotagging feature which we turned into a properly robust feature in the recent version 17 release, with another improvement for coarse location support in the version 18 release. I think we might have had a similar issue.
https://github.com/GrapheneOS/Camera/compare/16...17
https://github.com/GrapheneOS/Camera/compare/17...18
APIs did not really work the way we expected from the documentation. I don't know the exact details since I wasn't the one working on this but it's possible there's a similar issue.
@thestinger Am I correctly understood that you can still reproduce this issue with Organic Maps?
I re-tested the latest master without Google Location Services in my backyard on Pixel 4a:
Please note that the app shows "Continue detecting your current location?" dialog after ~30 seconds. You need to click "Continue" and wait more time to get the location. What do we think about removing "Continue detecting your current location?" (
drape->SetUserPositionPendingTimeoutListener
) dialog?Please note that organicmaps/organicmaps#2342 is not related to this issue, because it is about Google Location Services.
@rtsisyk The same bug from another user, GPS doesn't work until another app gets a lock. I assume it's related to our error processing of gms. And looks like it's an old issue. Also I think it is directly related to #2342
The primary cause of this problem is that the app stopped to search for location after 30 seconds by showing "Continue detecting your current location?" dialog. The latest version continues to search for location until you press "No" in that dialog. Please note that you should keep the app open and don't turn screen off and/or switch to another apps. Organic Maps disables location services when you switch from the app.