How to add a mobile view to an Android Auto app?

85 Views Asked by At

I want do develop an Android App that has an Android Auto view as well as a classic mobile view. I successfully developed the Android Auto app, so it shows the desired view in my car. Now I want to add a view that works for mobile. So far the AndroidManifest.xml did not have an Activity just the CarService. I added a MainActivity class and also added it to the AndroidManifest.xml as launcher activity. Under res/layout I added a activity_main.xml for the screens layout. It all compiles, but only the Android Auto part still works, on mobile the app flashes up and immediately terminates without any error. It also doesn't show the launcher icon. Is it even possible to mix mobile and Auto screens? Thanks

1

There are 1 best solutions below

0
On

Yes it's possible to have both mobile app and auto app "screens". In mobile by screens I assume you're reffering to Activity/Fragment though.

I suggest you follow this codelab.

You will see that there's a module for mobile app and a module for auto app. For the mobile app you have a separate manifest and related activity / source files. And for the Android auto app you've also a separate manifest and service / screen.

You've to add / customize the activity in mobile app module to have a "screen" in mobile app.