Android Automotive OS allows users to install apps in the car. To reach users on this platform, you need to distribute a driver-optimized app that is compatible with Android Automotive OS. You can re-use almost all of the code and resources in your Android Auto app, but you must create a separate build that meets the requirements described on this page.
To run your car app on Android Automotive OS, you need the latest Templates Host, which comes as a system app.
Development overview
Adding Android Automotive OS support only requires a few steps, as described in sections on this page:
- Create an automotive module
- Declare support for Android Automotive OS
- Declare your
CarAppService
andCarAppActivity
- Update your Gradle dependencies
Use Android Studio Bumblebee or newer to ensure that all Automotive OS features are enabled.
Create an automotive module
Some components of Android Automotive OS, such as the manifest, have platform-specific requirements. Create a module that can keep the code for these components separate from other code in your project, such as the code used for your phone app.
For an existing project, follow these steps to add an automotive module to your project:
- In Android Studio, click File > New > New Module.
- Select Automotive Module, then click Next.
- Provide an Application/Library name. This is the name that users see for your app on Android Automotive OS.
- Enter a Module name.
- Edit the Package name to match your existing app.
Select API 29: Android 10 (Q) for the Minimum SDK, then click Next. All cars that support the Car App Library on Android Automotive OS run on Android 10 API level 29 or higher, so selecting this value targets all compatible cars.
Select Add No Activity, then click Finish.
If you are starting a new project:
- In Android Studio, click File > New > New Project.
- Select Automotive for Project Type.
- Select No Activity, then click Next.
- Provide a Name for your project. This is the name that users see for your app on Android Automotive OS.
- Enter a Package name. See the Package names section for more details on selecting a package name.
Select API 29: Android 10 (Q) for the Minimum SDK, then click Next.
All cars that support the Car App Library on Android Automotive OS run on Android 10 API level 29 or higher, so selecting this value targets all compatible cars.
After you create your module in Android Studio, open the AndroidManifest.xml
file in your new automotive module:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.car.app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" />
<uses-feature
android:name="android.hardware.type.automotive"
android:required="true" />
</manifest>
The application
element has some
standard app information as well as a uses-feature
element that declares support for Android Automotive OS. Note that there
are no activities declared in the manifest.
Next, add the following uses-feature
elements to your manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.car.app"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" /> <uses-feature android:name="android.hardware.type.automotive" android:required="true" /> <uses-feature android:name="android.software.car.templates_host" android:required="true" /> <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" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> </manifest>
The first uses-feature
element declares that your app uses the Templates Host
to run. Explicitly setting the remaining four uses-feature
elements to
required="false"
ensures that your app doesn't conflict with available hardware features
in Android Automotive OS devices.
Declare support for Android Automotive OS
Use the following manifest entry to declare that your app supports Android Automotive OS:
<application>
...
<meta-data android:name="com.android.automotive"
android:resource="@xml/automotive_app_desc"/>
...
</application>
This manifest entry refers to an XML file that declares the automotive capabilities that your app supports.
To indicate that you have a Car App Library app,
add an XML file named automotive_app_desc.xml
to the res/xml/
directory in
your Android Automotive OS module. This file should include the following content:
<automotiveApp>
<uses name="template"/>
</automotiveApp>
Declare your CarAppService and CarAppActivity
Android Automotive OS uses your CarAppService
implementation and
CarAppActivity
declaration to launch your app. Refer to
Create your CarAppService and Session and
Declare your CarAppService for instructions on
implementing and declaring your CarAppService
.
On Android Automotive OS, a Screen
is rendered on an Activity
that is
included in the Car App Library. However, you must declare it in your manifest with
the following activity
element:
<activity android:exported="true" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:name="androidx.car.app.activity.CarAppActivity" android:launchMode="singleTask" android:label="Your app name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <!-- Include the category below ONLY for navigation apps --> <category android:name="android.intent.category.APP_MAPS" /> </intent-filter> <!-- Include the intent-filter below ONLY for navigation apps --> <intent-filter> <action android:name="androidx.car.app.action.NAVIGATE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="geo" /> </intent-filter> <meta-data android:name="distractionOptimized" android:value="true" /> </activity>
Update your Gradle dependencies
We recommend that you keep your CarAppService
in a separate module that you share between your phone app and your automotive
module. If you are using this approach, you need to update your automotive
module to include the shared module, as shown in the following snippet:
my-automotive-os-module/build.gradle
Groovy
buildscript { ... dependencies { ... implementation project(':shared_module_name') } }
Kotlin
buildscript { ... dependencies { ... implementation(project(":shared_module_name")) } }
Other Considerations
Keep these other considerations in mind when developing your Android Automotive OS app:
Package names
Because you distribute a separate Android Package Kit (APK) for Android Automotive OS, you can reuse the package name from your mobile app or create a new package name. If you use a different package name, your app has two separate Play Store listings. If you reuse your current package name, your app has a single listing across both platforms.
This is predominantly a business decision. For example, if you have one team working on the mobile app, and a separate team working on your Android Automotive OS app, then it might make sense to have separate package names and let each team manage its own Play Store listing. There is not a large difference in the technical effort required to use either approach.
The following table summarizes some other key differences between keeping your current package name or using a new package name:
Feature | Same package name | New package name |
---|---|---|
Store listing | Single | Multiple |
Mirrored install | Yes: fast app reinstall during the setup wizard | No |
Play Store Review process | Blocking reviews: if the review fails for one APK, other APKs submitted in the same release are blocked | Individual reviews |
Statistics, metrics, and vitals | Combined: you can filter by device name for automotive-specific data. | Separate |
Indexing and search ranking | Build off current standing | No carryover |
Integrating with other apps | Most likely no changes needed, assuming media code is shared between both APKs | Might have to update the corresponding app, such as for URI playback with Google Assistant |
Offline content
If applicable, implement offline support in your app. Cars with Android Automotive OS are expected to have their own data connectivity, meaning a data plan is included in the cost of the vehicle or paid for by the user. However, cars are also expected to have more variable connectivity than mobile devices.
Here are a few things to keep in mind as you consider your offline support strategy:
- The best time to download content is while your app is in use.
- Do not assume that WiFi is available. A car might never come into WiFi range, or the Original Equipment Manufacturer (OEM) might have disabled WiFi in favor of a cellular network.
- While it is okay to smartly cache content you expect users to use, we recommend that you let the user change this behavior.
- The disk space on cars varies, so give users a way to delete offline content.
Frequently asked questions
See the following sections for answers to some frequently asked questions about Android Automotive OS.
Are there any restrictions or recommendations for using third-party SDKs and libraries?
There are no specific guidelines on using third-party SDKs and libraries. If you choose to use third-party SDKs and libraries, you are still responsible for complying with all the car app quality requirements.
How do I publish my Android Automotive OS app using the Google Play Console?
The app publishing process is similar to publishing a phone app, but you use a different form factor. To opt in your app to use the Android Automotive OS release type, follow these steps:
- Open the Play Console.
- Select your app.
- From the left menu, select Release > Setup > Advanced settings > Release types.
- Select Add release type > Android Automotive OS, then follow the instructions in the Play Console.
Troubleshooting
See the following for help with some common troubleshooting scenarios on Android Automotive OS.
Even after uninstalling a Car App Library app from the system settings, I get an error when trying to install a new version.
To be sure that the app is uninstalled, use the command
adb uninstall app.package.name
.