Build video apps for Android Automotive OS

In addition to the guidelines described in Build parked apps for Android Automotive OS, there are some requirements specific to video apps.

Mark your app as a video app

To indicate that your app supports video, add an XML file named automotive_app_desc.xml to the res/xml/ directory in your project. In this file, include the following content:

<automotiveApp>
  <uses name="video"/>
</automotiveApp>

Then, within the <application> element of your manifest, add the following <meta-data> element referencing the XML file:

<meta-data
  android:name="com.android.automotive"
  android:resource="@xml/automotive_app_desc"/>

Support audio while driving

Audio while driving is a beta feature
Publishing apps that support audio while driving is limited to early access partners. While this feature is in beta, you can prepare your app for support by following the guidance in this section.

In general, all video apps must pause playback when user experience restrictions are active, as described in Ensure there are no distraction optimized activities.

However, some vehicles have the ability to display driving-optimized playback controls while user experience restrictions are active, making it possible to continue playing audio.

Driving optimized playback controls for an app that supports audio while driving.
Figure 1: Driving optimized playback controls for an app that supports audio while driving.

Declare that your app supports audio while driving

To indicate that your app supports audio while driving, add the following <uses-feature> element in your manifest:

<application ...>
    ...
    <uses-feature android:name="com.android.car.background_audio_while_driving" android:required="false">
    ....
</application>

Support background playback

Because your app's activities are hidden by the system UX restrictions, your app must support background playback to continue playing audio while driving. See Background playback with a MediaSessionService for details on how to accomplish this using the Media3 library.

Your app must post a MediaStyle notification that includes your app's MediaSession. If you're using MediaSessionService, this is handled for you by default.

Determine support

To determine if a device supports audio while driving, you can use the CarFeatures class from the androidx.car.app:app library.

CarFeatures.isFeatureEnabled(context, CarFeatures.FEATURE_BACKGROUND_AUDIO_WHILE_DRIVING)

Use this information to modify your app's behavior depending on the capabilities of the device it's running on. On devices that don't support audio while driving, your app must still meet the DD-2 guideline.

Test audio while driving

To test your implementation, you can simulate driving can using an emulator image that supports audio while driving.

Frequently asked questions

Is Widevine DRM supported?

Yes, Widevine DRM L3 is supported on Android Automotive OS.