Langsung ke konten

Paling sering dikunjungi

Terakhir dikunjungi

navigation

Getting Started with Auto

Dependencies and Prerequisites

  • Android 5.0 (API level 21) or higher

This class teaches you how to

  1. Set up an Auto project
  2. Add Auto features to your apps

You should also read

Android Auto extends the Android platform into the car. When users connect their handheld devices running Android 5.0 or higher to a compatible vehicle, the Auto user interface provides a car-optimized Android experience on the vehicle's screen. Users interact with compatible apps and services through voice actions and the vehicle's input controls (like a touchscreen or dashboard buttons).

Android Auto is also available on phone screens, giving users the full Android Auto experience entirely on the phone without needing to connect to a compatible vehicle. With this standalone, handheld version of Android Auto, users can still use voice to handle calls, messages, music, and navigation, using an interface designed for driving.

Auto currently supports two types of apps:

You can enable your existing audio and messaging apps developed for phones and tablets to work in the car, without having to worry about vehicle-specific hardware differences. To enable your app for Auto, your app must target Android 5.0 (API level 21) or higher. Adding support for Android Auto to your existing app will enable it to work on both car and phone screens. Android Auto handles most of the work to adjust each application's user interface to the screen on which it is displayed. Your app’s manifest must also declare the car capabilities that it uses, such as audio playback or messaging services.

Figure 1. Android Auto Home screen on dashboard.

Figure 2. Android Auto Home screen on phone.

This lesson describes how to start building apps for Auto, including setting up your development environment and meeting the minimum requirements to enable an app to communicate with Auto.

Set up an Auto project

This section describes how to create a new app or modify an existing app to communicate with Auto.

Prerequisites

Before you begin building apps for Auto, you must:

Declare Auto capabilities

The settings in your app manifest and a separate XML configuration file control the Auto features that your app can access. Before adding Auto features to your app, you must first define the Auto XML configuration file and add a manifest entry referencing your XML file.

Define the Auto XML configuration file

Specify the car capabilities that your app uses in an XML file that you place in your project’s resources directory (res/xml/). For example, to extend an audio application for Auto, create a file called automotive_app_desc.xml and store it under your projects’s res/xml/ folder. The automotive_app_desc.xml file contains the following metadata:

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

The <uses> element declares the Auto capability your app intends to use. If your application uses multiple car capabilities, you can add multiple <uses> tags. The name attribute indicates the specific capability your app uses. The values supported are:

Add a manifest entry

In your app’s manifest (AndroidManifest.xml), provide a reference to the Auto XML configuration file you created in the previous section. Add a "com.google.android.gms.car.application" metadata entry under the <application> element that references your Auto XML configuration file. Omit the .xml file extension when specifying the configuration filename.

The following code snippet shows how to include this reference in your manifest.

<application>

    ...
    <meta-data android:name="com.google.android.gms.car.application"
     android:resource="@xml/automotive_app_desc"/>

</application>

Add Auto features to your apps

After you complete the steps described above, you're ready to add Auto features to your apps. See these additional topics to help you build apps for Auto:

Important: Google takes driver distraction very seriously. Your app must meet specific design requirements to qualify as an Auto app on Google Play. By adhering to these requirements, you can reduce the effort for building and testing your app. For more information, see Auto App Quality.

Situs ini menggunakan cookies untuk menyimpan preferensi Anda tentang bahasa di situs tertentu dan opsi tampilan.

Dapatkan berita dan tips terbaru dari developer Android yang akan membantu Anda mencapai kesuksesan di Google Play.

* Wajib Diisi

Hore!

Ikuti Google Developers di WeChat

Buka situs ini dalam bahasa ?

Anda meminta halaman dalam bahasa , namun preferensi bahasa untuk situs ini adalah .

Ingin mengubah preferensi bahasa dan mengakses situs ini dalam bahasa ? Jika nanti Anda ingin mengubah preferensi bahasa, gunakan menu bahasa di bagian bawah setiap halaman.

Kelas ini memerlukan tingkat API atau yang lebih tinggi

Dokumen ini tersembunyi karena level API yang Anda pilih untuk dokumentasi ini adalah . Anda dapat mengubah level API dokumentasi dengan pemilih di atas menu navigasi sebelah kiri.

Untuk informasi lebih lanjut tentang menentukan level API yang diperlukan aplikasi Anda, baca Mendukung Versi Platform Yang Berbeda.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)