https://developer.android.com/training/auto/index.html

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.

Android Auto也可以在手机屏幕上使用,让用户完全可以在手机上体验到完全的Android体验,而不需要连接到兼容的车辆。有了这个独立的,手持版本的Android Auto,用户仍然可以使用声音来处理呼叫,消息,音乐和导航,使用一个设计的接口来驱动。

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.

你可以让你现有的音频和短信应用程序开发出来,用于手机和平板电脑,而无需担心特定于车辆的硬件差异。为了让你的app应用于车辆,你的target api必须大于等于21。

要开发应用于车辆的app,你必须做两件事

  1. Android 5.0 (API level 21) provides new APIs for implementing audio playback and messaging that is compatible with Auto. To access the new APIs, create a project or modify an existing project to target Android 5.0 (API level 21) or higher. This means you must set the manifest targetSdkVersion to 21 or higher.
  2. If you are building messaging apps for Auto, you need the NotificationCompat.CarExtender class contained in the v4 support library. This class allows you to create notifications that are compatible with Auto devices。

第一就是targetSdkVersion 大于等于21,第二就是在gradle中加入V4包。

Manifest相关配置

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

在 res/xml/ 的文件夹下创建 automotive_app_desc.xml,内容为

<automotiveApp>
    <uses name="media"/>
</automotiveApp>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值