android / car-samples

Multiple samples showing best practices for car app development on both Android Auto and Android Automotive OS.
Apache License 2.0
358 stars 166 forks source link

Integration of third party maps with Android Auto Cars Library #2

Open prasannab069 opened 4 years ago

prasannab069 commented 4 years ago

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.

SamuelBrucksch commented 3 years ago

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?

bgervan commented 3 years ago

Have you found a solution for this?

SamuelBrucksch commented 3 years ago

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

bgervan commented 3 years ago

How did you achieve that? With the PlaceListMapTemplate?

SamuelBrucksch commented 3 years ago

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

bgervan commented 3 years ago

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

bgervan commented 3 years ago

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

Android-AutoErrors commented 3 years ago

@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.

ghadeeraqraa1992 commented 3 years ago

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

jqn commented 2 years ago

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?

bgervan commented 2 years ago

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.

jqn commented 2 years ago

@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.

LeoAndo commented 2 years ago

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

gogamid commented 2 years ago

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

gogamid commented 2 years ago

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