-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 12 issues #59
Comments
apache/cordova-plugin-geolocation#235 |
Presumably related to this issue, I have been encountering similar problems with an app I am trying to create:
In addition to ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION, my app also has ACCESS_BACKGROUND_LOCATION, with the location permission being set to "Allow all the time". This setup worked perfectly on Android 11, it has only broken with Android 12. Phone info: Pixel 3a, Android 12 build SQ1A.220105.002 Hopefully this information helps, if you need specific logs or anything testing let me know. EDIT: The config being used:
|
Can you share logcat of this issue and the plugin's logs? |
Seems to be having issues on Android 12 apparently (HaylLtd/cordova-background-geolocation-plugin#59) I don't really have any alternative so I should probably look into it myself.
I did some further experiments with this issue, and have the following logs These were generated with this app: https://github.com/DanielLedger/debugApp In addition, although I forgot for the line generated by Test 2 (without OSMAnd): Hopefully this helps! |
I was expecting not to see anything on the map... |
I've upgraded my device to android 12 and I see similar issues. |
I'm using the raw provider. |
I've looked at the GPS Test code, it doesn't use the fused location provider but rather the |
I've opened a ticket to android since I can reproduce this in their emulator: |
I can confirm that the workaround solved the problem on a physical device. It's not ideal but it seems to work. |
@DanielLedger Feel free to review the PR I just opened. |
* Move distance location provider * Fix package name after movement * Added logging for provider selection * Hard code gps * Fixes #59 - Use GPS provider on android 31. * Fix hard coded parameter
The response in the issue tracker says that the API was deprecated but was not marked as such. |
Unfortunately, I still have inaccurate location detection without another application active. |
Can you check if you see the following lines in the log messages of the plugin: |
android6.txt |
I see in the logs that fused location is used, which is the cause of these inaccurate readings. Line 210 in 801548e
|
I have the latest version of the plugin installed, but the error remains. |
Yup, there's an if there that might cause the plugin to not use GPS provider, and use fused location. |
I have removed all the conditions. I left only the GPS provider. It still doesn't accurately show the location. |
Weird... If this doesn't work well with RAW provider then I don't have a good idea what's wrong. |
The above settings (https://github.com/IsraelHikingMap/Site/blob/1513d6095ede4e9ccb701eaf7dbeee386f912b1e/IsraelHiking.Web/src/application/services/geo-location.service.ts#L124) work for leaving the app open and recording accurately, however, I have been completely unsuccessful while getting background location updates if the device is locked with Android 12 (PIXEL 4 XL). Here are the config options that worked while locked for Android 11:
What's interesting is that with any config options I've tested for android 12, I've been also totally unable to even get the notification that background tracking is enabled. again, with android 11 it totally works as described. I have seen this error in the terminal when instantiating the background geo config. I recently solved a different issue with a different plugin that had the same issue.
Based off the final line of the above error, it seems the FLAG_IMMUTABLE needs to be present somewhere in the Java code for the notification to fire and from what I know the notification needs to be present for the locked device to update. I'll see if I can change something on the Java side to get this working. |
Yup that did it - I changed to this line in NotificationHelper.java. To be honest I'm not super familiar with Java and I'm not sure what this change does besides get the Android 12 to work lol if @HarelM could confirm it's safe I could fork or y'all could just update.
` |
Can you create a PR so I can better understand exactly what you changed? |
Ok I just submitted a PR with a fork, let me know how that looks. Thanks! |
I don't see any PR... did you make sure it's against this repo and not the parent one? |
I think it's here: HarelM#3 |
You need to create a PR against this repo next time :-) |
Hi @HarelM. I just upgrade to 2.0.8 version and the issue remains. Any update is retrived in background mode Android 12 API 31. I'm using DistanceFilterProvider Here is my plugin config:
|
Can you reproduce this in a simulator? |
Describe the bug
Location is not working well for android 12.
I'm still not sure what and why and this requires more investigation.
The only lead I have is this article:
https://developer.android.com/training/location/permissions#approximate-request
To Reproduce
Not sure...
Expected behavior
GPS should work
Desktop (please complete the following information):
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: