Build parked apps for Android Automotive OS

In addition to supporting apps built for use while driving, Android Automotive OS supports browsers, games, and video apps for use while parked. You can ship the same app to cars as you do to other large screen devices with just a few minor changes.

Test your existing app on an Android Automotive OS emulator

To begin building your app for Android Automotive OS, first test your existing app on an Android Automotive OS emulator. To set up an emulator, follow the steps in Test using the Android Automotive OS emulator. You can then run the app by following the instructions in Run your app on the emulator.

When running your app, watch for compatibility issues, such as the following:

  • Infotainment screens have fixed orientations. To meet the car app quality guidelines, apps must support both portrait and landscape orientations.
  • APIs available on other devices might not be available on Android Automotive OS. For example, some Google Play Services APIs are not available on Android Automotive OS. See the Disable features section for details on how to handle these issues.

Configure your app's manifest files

To target Android Automotive OS, your app must have certain manifest entries. With them, apps targeting Android Automotive OS are submitted to the Play Store using a separate Automotive OS release type. They are put through a manual review process to help ensure that they're safe for use in a car. See Distribute Android apps for cars for more details.

Required Android Automotive OS features

To be listed in the Play Store in a car, apps built for Android Automotive OS must include the following <uses-feature> element in the AndroidManifest.xml file:

<manifest ...>
    ...
    <uses-feature
        android:name="android.hardware.type.automotive"
        android:required="true" />
    ...
</manifest>

Apps submitted to non-automotive tracks can't declare the <uses-feature> element shown in the previous code sample, because they can't depend on car-specific hardware. So, to ship the same app for both automotive and non-automotive devices, you need to generate at least two flavors of your app: one for automotive devices and another for mobile devices. For more information about how to create these separate flavors, refer to the following documentation:

The two flavors of the app can share the same package name, but must have different version codes since they are uploaded to the Play Store tracks separately.

Alternatively, instead of using separate flavors, you can use separate package names for your mobile and automotive APKs or App Bundles. To understand the trade-offs of each approach, refer to Package names in the media app developer guide.

In addition to the element shown in the previous code sample, apps built for Android Automotive OS must include the following <uses-feature> elements in the root <manifest> element:

<uses-feature
  android:name="android.hardware.wifi"
  android:required="false"/>
<uses-feature
  android:name="android.hardware.screen.portrait"
  android:required="false"/>
<uses-feature
  android:name="android.hardware.screen.landscape"
  android:required="false"/>

Explicitly setting these features to not required helps ensure that your app doesn't conflict with available hardware features in Android Automotive OS devices.

Ensure there are no distraction-optimized activities

To ensure your app is only available for use while parked, don't include the following <meta-data> element in any <activity> element within your manifest:

<!-- NOT ALLOWED -->
<meta-data
  android:name="distractionOptimized"
  android:value="true"/>

Without this metadata, your app's activities are blocked automatically by the OS when the car enters driving mode, to reduce distractions for the driver. This happens as an onPause lifecycle callback, during which you must pause both video and audio playback from your app.

Optimize your app for Android Automotive OS

To give your users the best experience possible, you might need to activate or deactivate certain functionality depending on whether your app is running on a car.

Disable features

If you are making an existing mobile app available on Android Automotive OS, certain features and functionality might not be relevant or available. For example, cars generally don't provide access to cameras. Additionally, only a subset of Google Play services are available on Android Automotive OS; see Google Play services for cars for more details.

You can use the PackageManager.hasSystemFeature API to detect whether the app is running on Android Automotive OS by checking for the FEATURE_AUTOMOTIVE feature, as shown in the following example:

Kotlin

val packageManager: PackageManager = ... // Get a PackageManager from a Context
val isCar = packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
if (isCar) {
  // Enable or disable a given feature
}

Java

PackageManager packageManager = ... // Get a PackageManager from a Context
boolean isCar = packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
if (isCar) {
  // Enable or disable a given feature
}

Alternatively, if your app also has an Android Auto component, you can use the CarConnection API from the Android for Cars App Library to detect whether the app is running on Android Automotive OS or Android Auto—or if it is not connected to a car at all.

For Picture-in-Picture (PiP), follow the established best practices to check whether the feature is available and react appropriately.

Handle offline scenarios

While cars are becoming increasingly internet connected, apps are recommended to handle running without an internet connection, such as in the following cases:

  • Users might opt out of mobile data offered as part of a subscription package from the auto maker.
  • Access to mobile data might be limited in certain areas.
  • Cars with Wi-Fi radios might be out of Wi-Fi range, or an OEM might turn off Wi-Fi in favor of a mobile network.

Be prepared to handle these scenarios in your app by gracefully degrading functionality that depends on internet access, such as by offering offline content. For more information, see the best practices for optimizing networking.

Use alternate resources

To help adapt your app for cars, you can use the car resource qualifier to provide alternate resources when running on an Android Automotive OS vehicle. For example, if you use Dimension resources to store padding values, you could use a larger value for the car resource set to make touch targets larger.

Distribute your app

After you've tested your app against the car app quality guidelines for its category and made an Android Automotive OS build of it with any necessary changes for its category, you can then publish it to Automotive OS form factor tracks on the Play Store. See Distribute Android apps for cars for more details on the publishing process.

Give feedback on parked apps

If you run into an issue or have a feature request while developing your parked app for Android Automotive OS, you can report it using the Google Issue Tracker. Be sure to fill out all the requested information in the issue template. Before filing a new issue, check whether it is already reported in the issues list. You can subscribe and vote for issues by clicking the star for an issue in the tracker. For more information, see Subscribing to an Issue.

Create a new issue