向媒体应用添加对 Android Auto 的支持
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您需要对应用的清单进行一些更改,让 Android Auto 能够发现应用的媒体浏览器服务并与之互动。
声明 Android Auto 媒体支持
使用以下清单条目来声明您的手机应用支持 Android Auto:
<application>
...
<meta-data android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc"/>
...
</application>
此清单条目引用了一个 XML 文件,用于声明应用支持的汽车功能。为了表明您有媒体应用,请将名为 automotive_app_desc.xml
的 XML 文件添加到项目的 res/xml/
目录中。此文件应包含以下内容:
<automotiveApp>
<uses name="media"/>
</automotiveApp>
报告 Android Auto 媒体问题
如果您在开发 Android Auto 媒体应用时遇到问题,可以使用 Google 问题跟踪器报告该问题。请务必在问题模板中填写所有必填信息。
创建新问题
在提交新问题之前,请先查看问题列表,确认该问题是否已报告过。您可以在跟踪器中点击问题的星标来对问题进行订阅和投票。如需了解详情,请参阅订阅问题。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Add support for Android Auto to your media app\n\nYou need to make a few changes to your app's manifest so that Android Auto\ncan discover and interact with your app's media browser service.\n| **Important:** This guide assumes that you have already [built a media browser service](/training/cars/media#implement_browser) and you want to add support for Android Auto to your existing project. If you are new to app development for cars, see the [Android for Cars overview page](/training/cars).\n\nDeclare media support for Android Auto\n--------------------------------------\n\nUse the following manifest entry to declare that your phone app supports\nAndroid Auto: \n\n \u003capplication\u003e\n ...\n \u003cmeta-data android:name=\"com.google.android.gms.car.application\"\n android:resource=\"@xml/automotive_app_desc\"/\u003e\n ...\n \u003c/application\u003e\n\nThis manifest entry refers to an XML file that declares what automotive\ncapabilities your app supports. To indicate that you have a media app, add an\nXML file named `automotive_app_desc.xml` to the `res/xml/` directory in your\nproject. This file should include the following content: \n\n \u003cautomotiveApp\u003e\n \u003cuses name=\"media\"/\u003e\n \u003c/automotiveApp\u003e\n\nReport an Android Auto Media issue\n----------------------------------\n\nIf you run into an issue while developing your media app for Android Auto, you\ncan report it using the\n[Google Issue Tracker](https://issuetracker.google.com/issues?q=status:open%20componentid:192643).\nBe sure to fill out all the requested information in the issue template.\n\n[Create a new issue](https://issuetracker.google.com/issues/new?component=192643)\n\nBefore filing a new issue, please check whether it is already reported in the issues\nlist. You can subscribe to and vote for issues by clicking the star for an issue in\nthe tracker. For more information, see\n[Subscribing to an Issue](https://developers.google.com/issue-tracker/guides/subscribe#starring_an_issue)."]]