Skip to content

marcespinoza/android-auto-sample

Repository files navigation

Android Auto Sample App 🚗

This is small sample project to show how you can add android auto support to your project. In this particular case is a media app, but of course you can create other such a message or navigation app.

I recommend this great tutorial to understand deeper https://proandroiddev.com/android-auto-tutorial-step-by-step-guide-50bb6b73e2b8

Basic keys 🔑

Add to your manifest

    <meta-data
        android:name="com.google.android.gms.car.application"
        android:resource="@xml/automotive_app_desc" />

    <service android:name=".service.MediaService"
        android:exported="true">
        <intent-filter>
            <action android:name="android.media.browse.MediaBrowserService" />
        </intent-filter>
    </service>

automotive_app_desc.xml

    <?xml version="1.0" encoding="utf-8"?>
    <automotiveApp>
        <uses name="media" />
    </automotiveApp>

Voice actions support 🗣️

To support voice actions you need to implement onPlayFromSearch method in your media session callback.

    override fun onPlayFromSearch(query: String?, extras: Bundle?) {
        super.onPlayFromSearch(query, extras)
    }

Desktop head unit

To test your app you need to install the desktop head unit, install it following this instructions https://developer.android.com/training/cars/testing/dhu imagecarauto

Sample App 📱

This is how it looks the sample app, notice that you dont have to create any view, android does it for you, all you have to do is pass it the necessary data to media session and thats it.

Screenshot from 2025-10-25 10-54-49 Screenshot from 2025-10-25 10-54-40

I hope it has been useful to you 🫶

About

✔️ Sample to show how to add android auto support to your app.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages