osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.37k stars 987 forks source link

Android Auto does not show current location unless OsmAnd is open on the phone #19839

Open mdykierek opened 1 month ago

mdykierek commented 1 month ago

Description

When setting route from the car's screen, the route and car position and direction does not show. I have to open OsmAnd+ UI on the phone to show center the map and show vehicle position and heading.

Steps to reproduce

Set a route on car's screen and drive.

Actual result

Car's location and heading is not shown on the car's screen.

Expected result

Location and route should be centered and shown without need to open OsmAnd on the phone.

Your Environment (required)

WARNING Crash-Logs MAY contain information you deem sensitive. Review this CAREFULLY before posting your issue!

OsmAnd Version:
Android/iOS version:
Device model:
Crash-Logs: ?
yuriiurshuliak commented 1 month ago

Please indicate the application version you are using. What GPS permissions have been granted: Continuous or One-time use? Which location source is employed: Google Play Services or Android API? Have you enabled device/battery optimization?

mdykierek commented 1 month ago
  1. OsmAnd+ version 4.7.17
  2. Android 14 on. Motorola Edge 40 Pro
  3. Android Auto 11.8.641624-release
  4. Toyota Corlolla '21
  5. GPS access is granted for "When using App" - there is no continuous option.
  6. Location Source is Google Play Services
  7. I usually do have battery saver enabled, but Android Auto requires USB connection and this means the device is being charged. When charging battery saver is irrelevant and marked as unavailable.

I will try to figure out more exact steps to reproduce as sometimes it occurs more often. It definitely is not a one time thing. I avoid reporting such things as I treat them as my mistakes or lack of understanding how thing work.

mdykierek commented 1 month ago

So I nailed it. The behavior can be observed when the destination is on/behind a private access road. My house is located in such place. So I leave the office, set destination=Home and drive. The voice prompts, the lane assistance work fine, but the map does not show up:

So you need to unlock the phone an open the OsmAnd to see that is asks a question there:

You don't need to answer. The map on car's screen is back to normal. My workaround is to move the Home to a public access road and the problem is gone. But if for example you put in an address that is private, you are in trouble.

DmitryAlexei commented 1 month ago

I tried several times to reproduce your issue on release version (OsmAnd 4.7.17, released: 2024-05-07) and head unit simulator, but almost every time it worked fine.

Actual result

As a workaround in your case, I suggest enabling Allow private access in the OsmAnd navigation settings.

Galbar commented 1 month ago

I'm having the same issue. I've also noticed that it gets solved if I open the app on the phone and hit button to center the map on my location. Tapping on the button on the Android Auto display does not work when this is happening. The rest of the navigation works fine, though. It is just the map visualization.

I'm on OsmAnd+ 4.7.17

mdykierek commented 1 month ago

Two pieces of news:

  1. Tried private access. Results were strange. For example route to an airport first led through hotel alleys and used starting lanes and restricted areas.
  2. The worse thing is, that today I had it twice and the destination nor any road on the way was private. So my "nailed" is for one of possible scenarios only.
mdykierek commented 1 month ago

Two videos that show the behavior. This week I have it all the time, every ride I make. Sorry for the quality, but they show our point. The second video shows that the GPS data is coming in and the speed widget updates correctly. The rest of display does not. Note that I moved my Home destination away from private road.

https://github.com/osmandapp/OsmAnd/assets/27214784/249dc2a4-6d79-4ebe-ba33-9d1be65f1451

https://github.com/osmandapp/OsmAnd/assets/27214784/1ad7e94d-4d8a-48d6-8ecb-c8943ecd9fe8

mdykierek commented 1 month ago

A new symptom. After the navigation has completed, the display froze. Even "Free ride" did not display the location and movement.

SnejPro commented 3 weeks ago

I observed the same issue. I think the reason is that I can not grant OsmAnd access to the location while in background.

When I open the app it works fine. I have the issue regardless whether the destination is in a private road.

Greetings jens

SnejPro commented 3 weeks ago

Device: Google Pixel 8a Android: 14 Version: 4.7.17 (Google Play)

mdykierek commented 3 weeks ago

The location access permission is not the reason. Let me explain why I think so:

  1. The app is on the car's screen, so most probably it is in use.
  2. For me, having the app open and active causes slow refresh (another report), so I have to put it in background and the problem does not come back.
  3. The navigation works, it knows the speed. For some reason map is "frozen". Maybe it's the on-screen menu/start navigation in Android Auto that "misbehave"? I don't know. It is hard to drive and "debug".
SnejPro commented 3 weeks ago

The location access permission is not the reason. Let me explain why I think so:

  1. The app is on the car's screen, so most probably it is in use.
  2. For me, having the app open and active causes slow refresh (another report), so I have to put it in background and the problem does not come back.
  3. The navigation works, it knows the speed. For some reason map is "frozen". Maybe it's the on-screen menu/start navigation in Android Auto that "misbehave"? I don't know. It is hard to drive and "debug".

Sound's plausible. But maybe it is worth a try allowing the users to grant osmand "background" position permissions? It would be an easy fix.

mdykierek commented 3 weeks ago

I did report such an issue in the past. There was a version that would not work for me if OsmAnd was not open and in foreground. The permanent setting supposedly is gone since Android 11: #13732. In my case showing UI on the phone is enough to fix Android Auto. Then it can be put in background and the phone can be locked.

Galbar commented 3 weeks ago

I have noticed that it happens after I have used the map app outside of the car (i.e. to look for places while on foot). Maybe another hint?