car-samples icon indicating copy to clipboard operation
car-samples copied to clipboard

Integration of third party maps with Android Auto Cars Library

Open prasannab069 opened this issue 3 years ago • 15 comments

I am integrating Android Auto Car Library for my navigation application. i have implemented navigation template successfully but stuck in integrating third party maps sdk(Like here maps, mapbox etc) as there is only an option for drawing own map rendering with canvas. Any help would highly be appreciated. Thanks.

prasannab069 avatar Nov 09 '20 12:11 prasannab069

I'm currently stumbling across this as well.

In the showcase sample app there is a class PlaceListTemplateDemoScreen that uses PlaceListMapTemplate where a map is drawn. However i could not find the difference to PlaceListNavigationTemplateDemoScreen that uses PlaceListNavigationTemplate with regards to how to activate that a map is shown.

As far as i can see, the PlaceListTemplateDemoScreen does not use a custom SurfaceRenderer like PlaceListNavigationTemplateDemoScreen.

Is there any other way to just use default map from google or do we really have to draw the map ourself somehow? The documentation says that we need to draw it ourself, but its a bit complex to draw a map for navigation when moving with just a canvas.

@prasannab069 Did you get navigation to work with custom maps in the meantime?

SamuelBrucksch avatar Dec 16 '20 14:12 SamuelBrucksch

Have you found a solution for this?

bgervan avatar Apr 26 '21 14:04 bgervan

Mapbox beta v10 works with AA and also osmdroid with some additional effort.

SamuelBrucksch avatar Apr 26 '21 15:04 SamuelBrucksch

How did you achieve that? With the PlaceListMapTemplate?

bgervan avatar Apr 26 '21 15:04 bgervan

What exactly? You have to draw the map yourself in the SurfaceRenderer

SamuelBrucksch avatar Apr 26 '21 15:04 SamuelBrucksch

I tried to use MapSnapshotter, but the car icon and other layers doesn't appear for me, is it working on your side?

bgervan avatar May 20 '21 09:05 bgervan

Nevermind - for others: There is a snapshot and takeScreenshot function for map and navigationMap classes. It adds the layers.

bgervan avatar May 20 '21 11:05 bgervan

@SamuelBrucksch > Mapbox beta v10 works with AA and also osmdroid with some additional effort.

Do you mind sharing your manifest file and Gradle file (only related to the android auto part)? Your help would be highly appreciated. I am having a problem getting the Navigation app detected in the Desktop Head unit. Even @google-admin provided sample "Hellp World" navigation app isn't getting detected in the Desktop Head unit.

@prasannab069 Are you able to detect your NAVIGATION app in Android Auto or desktop head unit? If so, do you mind sharing your manifest file and Gradle file (only related to the android auto part)? That would be of great help.

Android-AutoErrors avatar May 23 '21 21:05 Android-AutoErrors

What exactly? You have to draw the map yourself in the SurfaceRenderer

could you please share your SurfaceRenderer code ? that would be of great help

ghadeeraqraa1992 avatar Jul 05 '21 07:07 ghadeeraqraa1992

It would be great if there was some support, struggling with the same issue. Is there any place to get some guidance on how to do this?

jqn avatar Jan 16 '22 17:01 jqn

It would be great if there was some support, struggling with the same issue. Is there any place to get some guidance on how to do this?

If you are using mapbox, they did an example app with their latest version (v10?), there are workaround without that too, but this example is more native, with scroll etc.

bgervan avatar Jan 16 '22 17:01 bgervan

@bgervan what would that workaround be. I've been trying everything and couldn't figure it out. The downside of the mapbx example app is that is written in Kotlin and I'm not familiar with it.

jqn avatar Jan 23 '22 13:01 jqn

Is MapBox the only third-party map library that currently supports Android Auto?

https://docs.mapbox.com/android/navigation/guides/advanced/android-auto/ https://github.com/mapbox/mapbox-navigation-android-examples

LeoAndo avatar Apr 18 '22 10:04 LeoAndo

this guy implemented map with osmdroid for main screen of android automotive, maybe it will be useful https://github.com/snappautomotive/SnappMaps

gogamid avatar Aug 21 '22 21:08 gogamid

I have integrated Mapbox to Automotive or Android Auto application minimalistically, you can check it out: https://github.com/gogamid/mapbox-automotive-integration/tree/main Screenshot_1667862474

gogamid avatar Nov 07 '22 23:11 gogamid