One of Android Auto development, "Start learning Auto"

Source: Internet
Author: User

Common learning, common progress, reproduced please indicate the source. Welcome to Exchange:Sfssqs, apply for the words "Android Car"

================= =========================

HTTPS://developer.android.com/traning/auto/start/index.xml

Let's study Android Auto together.

Android Auto inherits from the Android platform and serves the car system. The handheld device needs to run in Android5.0 or higher, and when the user connects it to a compatible car, the auto provides the interface to interact with the handheld device's application in the car's central control screen. Users interact with compatible applications or services through voice or in-vehicle devices such as touch screens, instrument buttons, and so on.

Auto currently supports two types of application scenarios:

    • Audio type that allows users to browse and play music and speak through the mic inside the car.
    • Message type, receive information notifications, read messages through text-to-speech, and reply to information via mic inside the car.

The audio and message type applications that developers now run on phones and tablets can be transformed into auto, without worrying about differences in hardware implementations. In order for the app to run on the car, the app's target device must be Android5.0 (API level21) or above. Manifest also needs to declare the type of car used, such as the type of audio playback or the type of information service.

This article describes how to build an auto application, including development environment configuration, basic environment requirements, and so on.

Create an Auto Project

——————————

This section describes how to create an auto-type app or modify an existing Android app to support auto use.

Preparatory work

Before building an automotive application, you need:

    • New or updated app Engineering-android 5.0 (API level 21) provides the interface to enable the compatibility of automotive audio playback and information-related functions. In order to be able to use the new interface, the targetsdkversion in the engineering manifest to be set to Android 5.0 (API level 21) or higher.
    • Install support libraries-if you are building messaging related applications in your car, you need to V4 the Notificationcompat.carextender class in the supporting library. This class allows for the creation of notifications that are compatible with car equipment.

Declaring car properties

The App Access Auto feature is controlled by manifest settings and independent XML configuration files. Before adding the Auto feature, define the auto XML configuration file and reference the file at the manifest portal.

1. Defining the Auto XML configuration file

XML is placed in the directory (Res/xml). For example, to extend an audio app on a car, create a file Automotive_app_dec.xml placed under the Res/xml folder of the project. The file contains the following metadata:

<automotiveApp>    <uses name= "Media"/></automotiveapp>

The <uses> element defines the auto attribute to be used by the app. You can add multiple <uses> tags at the same time to support multiple auto properties. The supported properties are:

    • Media-app uses the Android framework to play music on the car API. If you want to support audio in your app, set this value.
    • notification-displays a message notification on the car screen, allowing the user to select a message to read, or to reply by voice input. Set this value if you want to support the functionality of the message type.

2. Add Manifest entry

A reference to the auto XML configuration file in the Androidmanifest.xml file. Add "com.google.android.gms.car.application" metadata under the <application> element and reference the configuration file. To remove the file suffix of the. Xml.

The following code shows how to add a drink to the manifest.

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

Add auto functionality to your app

By completing the steps above, you are ready to add auto functionality to your app. Read more about the Auto app's documentation

    • Add audio playback capabilities to your car
    • Add messaging and messaging to your car

Important: Google is very cautious about the scenario that distracts the driver's attention. So define a set of design specifications that you want to follow on Google Play on the shelves. Adhering to the requirements of the design code will greatly reduce the rebuilding and testing of the app. For more information, please follow-auto App quality.

One of Android Auto development, "Start learning Auto"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.