Review the following information to learn how make changes to your app's manifest
so that Android Auto can discover and interact with your app's CarAppService
.
Declare Android Auto support
The Android Auto host checks whether the app has declared support for Android Auto. To enable this support, include the following entry in your app's manifest:
<application>
...
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc"/>
...
</application>
This manifest entry refers to another XML file that you create with the
path AppProjectDirectory/app/src/main/res/xml/automotive_app_desc.xml
.
In that file, you declare what Android Auto capabilities your app supports.
Apps using the Android for Cars App
Library
must declare the template
capability in the automotive_app_desc.xml
file:
<automotiveApp>
<uses name="template" />
</automotiveApp>
Set your app's minSdkVersion
Android Auto requires your app to target Android 6.0 (API level 23) or higher.
To specify this value in your project, set the minSdkVersion
attribute in
the uses-sdk
element to 23 or higher in your phone app module's
AndroidManifest.xml
file, as shown in the following example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ... > <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="33" /> ... </manifest>
Running the app on a real head unit
For your app to run on a real head unit—not the Desktop Head Unit—your app must be distributed through the Google Play Store. This ensures that your application has been tested and vetted for adherence to the Google Play guidelines. These guidelines help ensure that your application is relevant to the car environment and that it passes the driver distraction tests. See Add support for Android Automotive OS to your app.
For testing while under development, there are three options:
- Use the Desktop Head Unit.
- Push your application to a Google Play Store's internal test track. The internal test track lets you manually add your team for internal testing. Releases to this track don't require Google Play Store reviews.
- Share your application with internal app sharing in the Google Play Console. Similar to the internal test track, this does not require Google Play Store reviews.