My Journey on developing a Custom Android Auto app
Android Auto is around for a while now and some major players such as Spotify and recently Waze (although still in beta) have already integrated with the new auto platform. There are rumours about car manufacturers such as Hyundai that would be able to develop custom third party apps on the Android Auto platform. The only official support there is right now is for message notifications and for audio players (music, books, podcasts,…). But both Waze and Hyundai (and potentially any other manufacturer) have some kind of private access to custom app API’s.
So, challenge accepted, let’s try to build a custom Android Auto app!
Step 1: look around, search for any clue where to start! So that’s what I did and I came up with an official Google page about the design guidelines for custom apps and one very limited StackOverflow post. So the first one only told me that it should be possible. With the second I just knew it would be possible.
Step 2: Try to get something up and running ASAP. So I’ve just set up a simple Android phone project with an empty activity and started following the StackOverflow post. So here’s what you have to do:
1. Include an unofficial Android Auto JAR as library in your libs-directory
2. Create a new Service that extends the CarActivityService and define it in the AndroidManifest that launches a CarActivity.
3. Create an automotive_app_desc XML file in XML-resources and define it in the AndroidManifest.
Step 3: Go wild! After having created a simple Hello World view that displays on the car unit or the Desktop Head Unit (for development) you can go and investigate everything there is to find in Android Auto framework. The first thing I did was to built-in a Menu and show a title for my custom application. To do so you should have a look at getCarUiController().getStatusBarController() and getCarUiController().getMenuController() inside the CarActivity.
The first major problem I has was that in my phone app (which is the same codebase and thus the same dependencies) Android Studio had issues with the usage of V4 and V7 Support libraries. That’s because the JAR that you have to include that is posted on StackOverflow contains a version (most likely an older version) of these support libraries. So I repackaged the JAR so that it only includes the Android Auto source and so you have to add the V4 and V7 dependencies yourself in your build.gradle file. The file is available in the Android Auto Hello World GitHub project.
Last but not least it didn’t show up on my car’s unit. I’m having a Volkswagen Touran and the only thing it showed was to take me back to the Volkswagen interface. Until Emil Boroconi hinted me to enable unknown sources in the Android Auto developer settings. That just did the trick.
So now you should be good to go for your very first Android Auto custom application. Just take note that you won’t be able to deploy this in the Google Play store as the Android Auto library is non-official so far and most likely you apps won’t show up on the car’s unit unless the users enable developer mode etc on their device, which you don’t want to!