osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.58k stars 1.01k forks source link

Google Play Services location crash with AndroidAuto #16111

Closed oxygen155 closed 1 year ago

oxygen155 commented 1 year ago

Description

When using app in car via AA screen, after a short while (1-2 minutes since launching) location gets very inaccurate. It mostly stops at the place of last known location. When I unlock the phone (still connected to AA), I see there is a message about Google Play Services ANR (crash). When I switch location source to Android API, this does not happen, but location is less accurate and have huge lag - impossible to use in a city with complex navigation route.

How to reproduce?

Use Google Play Services as Location Source.

Your Environment

OsmAnd Version: 4.3.5 (beta apk from Play Store) Android/iOS version: Android 12 with MIUI 13.0.4.0 (SJIEUXM) Device model: Xiaomi Mi 10 Lite 5G (M2002J9G)

Maps used (online or offline):
Using offline map but with 4G data connection.

Unfortunately, I cannot test with any other phone model to check if the problem is with my phone only. However, any other navi app don't crash Play Services. Also, during navigation outside of AA, everything is working without issues. I also cannot get logcat at that moment, because I am already driving..

mitohund commented 1 year ago

Ah finally I found the appropriate issue. I'm also experiencing this behaviour - only difference is I don't get an error message. Otherwise same thing. It has made Osmand unusable on Android Auto. Two other navigation apps I'm using don't have this problem.

I think this issue may have been introduced with the update to Android 12 (EDIT: I incorrectly wrote 13 before, but that was a different phone).

OnePlus 7 Android 12 (EDIT: corrected from Android 13) OsmAnd+ 4.3.6 Google Play Store version

oxygen155 commented 1 year ago

I also did not had any error messages popping up before. Then I went to Developer Options in Android Settings and enabled "Always show crash dialog" and "Show background ANRs", and there you go - "Play Services has stopped working"

I think the issue lies with a newer Play Services update (I have the latest apk version) - I have seen somewhere that "location libraries" were updated. I did not had any issues with AA + OsmAnd before, in November.

mitohund commented 1 year ago

Thanks for the details - I turned on those options as well. Let's see if I get the same error message.

Did you also update to Android 12 lately? I also did not have these problems a few weeks/months ago.

oxygen155 commented 1 year ago

No, phone has received an update to Android 12 / MIUI 13 almost a year ago - around April 2022. But I've started using OsmAnd more actively (for navigation in car too) since November. So I cannot tell if this issue could have happened earlier.

mitohund commented 1 year ago

I'm not getting any error messages despite enabling the settings you mentioned. Are those regular Android notifications or do I need to go into some kind of log?

Also, it seems like the behaviour is slightly better now. It's not like it used to be (last summer I used OsmAnd to drive across several countries), but it does seem to not completely break as it did the last few weeks/months. I'm wondering if the issue lies with some Android Auto updates and not with OsmAnd. It's weird though that other navigation apps do not have this problem.

I was also wondering why there aren't more people here. I would think we are not the only ones with this issue. Maybe it would make sense to change the title to something like "Android Auto unusable, location not updating"?

oxygen155 commented 1 year ago

Maybe your GPlay Services just hangs and not crashes - that's why there are no messages.

Also, I don't know if this is related.. I was testing if things got fixed after APKs were updated to AA 8.7.xx, GPS 23.03.xx, and OsmAnd 4.3.6-4.3.7. At first everything was working, then I've noticed that app was in "Browse map" profile, and I have switched to "Car/Driving" profile, and soon after my location have stopped updating on car's infotainment screen.

Need to test this theory - if switching to "driving" profile triggers GPS crash and loss of location tracking.

P.S. Also, I don't think that OsmAnd is that popular. There still not that many cars with AA on the road. Most less tech-savvy people would use Google Maps/Waze anyway, because that is more than enough for them, so why bother with some "geeky" apps.

vshcherb commented 1 year ago

We just fixed issue with Android Auto Search doesn't work - ANR, so it's going to be released with 4.3.9 probably it helps

oxygen155 commented 1 year ago

Unfortunately the issue still persists on 4.3.10

mitohund commented 1 year ago

I've recently been having issues with another navigation app I use (AmiGO by Tom Tom). Makes me think that Google may have changed something in Android Auto. :-(

In fact, Google Maps is the only reliable option for me right now. This is nasty.

mitohund commented 1 year ago

I'm on 4.3.12 and Android Auto 8.8.630424-release, and am still having the same issues.

This is really a shame, since OsmAnd navigation works beautifully on the phone screen, particularly with OpenGL.

oxygen155 commented 1 year ago

yeah, same with me too.. Not fixed!

oxygen155 commented 1 year ago

So, I have upgraded my phone.. Everything is new, Android is v13 now. And, guess what? STILL NOT WORKING! And my previous phone, after full factory wipe - not working either..

Guess I won't be extending my subscription once it expires - because native AA support was the only reason I've bought the app. And it have worked for me only a few weeks in November 2022...

mitohund commented 1 year ago

Yeah, I also only paid for OsmAnd+ to get Android Auto...

Zirochkabila commented 1 year ago

Crash may be related to https://github.com/osmandapp/OsmAnd/issues/16607#issuecomment-1474822422

wolfsolver commented 1 year ago

@oxygen155 @mitohund I found a workaround that seems work, can you test and check if work also for you.

Seems that with recording and Android API navigation is fine

oxygen155 commented 1 year ago

Well, that's a loophole - you are just forcing the app to frequently update location. It should be able to do it on it's own in the background, through API. That is too much hassle for a regular user, who may suddenly require to use a navigation on-the-go. The beauty of AA, is that you can easily set up your route while driving.

In other words, it certainly is not working correctly - devs broke something, or cannot/forgot to implement changes from Google to AA.

I'm surprised it is not so widespread among other users. I can understand that this problem may be isolated only to MIUI devices, because they have a history with incompatibility in certain scenarios due to "system optimizations". But @mitohund has OnePlus, and he is experiencing same issues too.

mitohund commented 1 year ago

@wolfsolver thanks for the suggestion and I'm happy to try this. However, I agree with @oxygen155 that this can only be a solution for desperate moments. I don't even know how to record a track, so I would have to look that up first. 😄

wolfsolver commented 1 year ago

I agree. Is just a workaround to understand problem.

See my last comment in https://github.com/osmandapp/OsmAnd/issues/16607

oxygen155 commented 1 year ago

I'm on v4.4.6, and I'm happy to confirm that AA is working for me again. Maybe it was fixed in some earlier release already, I can't tell. It is not yet perfect, as location on the map still can be jumpy and lagging (even with Google Play Services as location provider), especially at complex intersections. But at least it is usable again on the car screen.

I can't be 100% sure, but I think movement on the map was much smoother and precise in v4.3 branch (when AA was still working for me, in October/November of 2022).

wolfsolver commented 1 year ago

Hi guys. Also for me works better. OsmAnd 4.4.6 AA 9.2.631214

Now navigation works also without open app. As @oxygen155 also on my device some lags are present, but it's usable.

rodrigorega commented 1 year ago

Same issue. I lose GPS when the screen gets blocked because inactivity. If I unlock the phone I got GPS fix instantly. I doesn't matter if I record the track or not.

OsmAnd+ 4.4.6 AA 9.2.631214 Android 12

mitohund commented 1 year ago

On 4.5.1 now and still cannot use the app. It does now what others have described: it lags behind more and more the longer I'm driving.

Zirochkabila commented 1 year ago

OsmAnd~ 4.5.0#254m, Released: 2023-06-20 Confirmed

vshcherb commented 1 year ago

Related https://github.com/osmandapp/OsmAnd/issues/17505?

vshcherb commented 1 year ago

Merged to https://github.com/osmandapp/OsmAnd/issues/17505