Build video apps for Android Automotive OS (original) (raw)
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 is a video app, add theandroid:appCategory="video" attribute to the element of your manifest.
<manifest ...>
...
<application
...
android:appCategory="video">
...
</application>
</manifest>
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 Meet driver distraction requirements.
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.
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 element in your manifest:
<manifest ...>
...
<uses-feature
android:name="com.android.car.background_audio_while_driving"
android:required="false" />
...
</manifest>
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. SeeBackground 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'sMediaSession. 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 theCarFeatures 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 anemulator image that supports audio while driving.
Frequently asked questions
Is Widevine DRM supported?
Yes, Widevine DRM L3 is supported on Android Automotive OS.