配置清单文件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
配置应用的清单文件,以与 Android Auto 和 Android Automotive OS (AAOS) 集成。如需允许这些平台发现和连接,请在清单中声明您的媒体浏览器服务。指定所需的应用图标,包括启动器图标和归因图标(供媒体控件等系统界面组件使用)。
如需详细了解清单文件,请参阅应用清单概览。
声明媒体浏览器服务
Android Auto 和 AAOS 通过媒体浏览器服务连接到您的应用,以便浏览媒体项。在清单中声明媒体浏览器服务,以便让 Android Auto 和 AAOS 发现该服务并关联到您的应用。
此代码段展示了如何在清单中声明媒体浏览器服务。将此代码包含在 AAOS 模块的清单文件和手机应用的清单文件中。
<application>
...
<service android:name=".MyMediaBrowserService"
android:exported="true">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService"/>
</intent-filter>
</service>
...
</application>
指定应用图标
如需在系统界面中表示您的应用,请指定 Android Auto 和 AAOS 应使用的应用图标。必须提供以下两种图标:
定义启动器图标
启动器图标用于在系统界面中表示您的应用,例如在启动器和图标托盘中。您可以使用以下清单声明,说明要使用您移动应用中的图标来表示您的汽车媒体应用。
<application
...
android:icon="@mipmap/ic_launcher"
...
/>
如果要使用的图标与移动应用的图标不同,请在清单中为您的媒体浏览器服务的 <service>
元素设置 android:icon
属性:
<application>
...
<service
...
android:icon="@mipmap/auto_launcher"
...
/>
</application>
定义提供方图标
提供方图标用于媒体内容优先的位置,例如媒体卡片上。您可以考虑重复使用用于表示通知的小图标。此图标必须是单色的。

图 1. 媒体卡片上的提供方图标。
您可以通过以下清单声明指定用于表示应用的图标:
<application>
...
<meta-data
android:name="androidx.car.app.TintableAttributionIcon"
android:resource="@drawable/ic_status_icon" />
...
</application>
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-22。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-22。"],[],[],null,["# Configure manifest files\n\nConfigure your app's manifest files to integrate with Android Auto and Android\nAutomotive OS (AAOS). To enable discovery and connection by these platforms,\ndeclare your media browser service in the manifest. Specify the required app\nicons, including a launcher icon for an attribution\nicon for use by system UI components such as media controls.\n\nTo learn more about manifest files, see [App manifest overview](/guide/topics/manifest/manifest-intro).\n\nDeclare your media browser service\n----------------------------------\n\nAndroid Auto and AAOS connect to your app through your media browser service to\nbrowse media items. Declare your media browser service in your manifest to let\nAndroid Auto and AAOS discover the service and connect to your app.\n\nThis code snippet shows how to declare your media browser service in your\nmanifest. The next section of this guide, [Create a media browser service](/training/cars/media/create-media-browser),\ndetails the process of implementing the service. \n\n \u003capplication\u003e\n ...\n \u003cservice android:name=\".MyMediaBrowserService\"\n android:exported=\"true\"\u003e\n \u003cintent-filter\u003e\n \u003caction android:name=\"android.media.browse.MediaBrowserService\"/\u003e\n \u003c/intent-filter\u003e\n \u003c/service\u003e\n ...\n \u003c/application\u003e\n\n| **Caution:** You might see a lint warning because the service is exported, but doesn't set the [`android:permission`](/guide/topics/manifest/service-element#prmsn) attribute. It's generally safe to ignore this warning because you can [Add package validation](/training/cars/media/create-media-browser/content-hierarchy#package-validation), which provides more control over which host apps can connect to your app.\n\nSpecify app icons\n-----------------\n\nTo represent your app in the system UI, specify the app icons that Android Auto\nand AAOS should use. These two icons are required:\n\n- [Define the launcher icon](#launcher-icon)\n- [Define the attribution icon](#attribution-icon)\n\n| **Design guidelines:** [Branding elements](/design/ui/cars/guides/app-cuj/branding-elements).\n\n### Define the launcher icon\n\nThe launcher icon represents your app in the system UI, such as on the launcher\nand in the tray of icons.\n\nBy default, the [`android:icon`](/guide/topics/manifest/application-element#icon) attribute of your app's\n[`\u003capplication\u003e`](/guide/topics/manifest/application-element) element is used as the launcher icon: \n\n \u003capplication\n ...\n android:icon=\"@mipmap/ic_launcher\"\n \u003e\n\nTo use a different icon, set the `android:icon` attribute of your media browser\nservice's [`\u003cservice\u003e`](/guide/topics/manifest/service-element) element: \n\n \u003capplication\u003e\n ...\n \u003cservice\n ...\n android:icon=\"@mipmap/ic_car_launcher\"/\u003e\n \u003c/application\u003e\n\n### Define the attribution icon\n\nThe attribution icon is used in places where media content takes precedence,\nsuch as on media cards. Consider reusing the small icon used for notifications.\nThis icon must be monochrome.\n\n**Figure 1.** Attribution icon on media card.\n\nYou can specify an icon that is used to represent your app using this manifest\ndeclaration: \n\n \u003capplication\u003e\n ...\n \u003cmeta-data\n android:name=\"androidx.car.app.TintableAttributionIcon\"\n android:resource=\"@drawable/ic_status_icon\" /\u003e\n ...\n \u003c/application\u003e\n\nSpecify your app's label\n------------------------\n\nBy default, the value of the [`android:label`](/guide/topics/manifest/application-element#label) attribute of your app's\n`\u003capplication\u003e` element is used as the display name for your app on the car\nscreen.\n\nTo use a different display name -- or if your app has multiple media browser\nservices -- set the `android:label` attribute of the media browser service's\n`\u003cservice\u003e` element.\n\nSpecify your app's accent color\n-------------------------------\n\nYour app's accent color is used by Android Auto and AAOS to style playback\ncontrols and other UI elements.\n\nBy default, the accent color is pulled from the [`colorAccent`](/reference/android/R.attr#colorAccent) item of the\n[`android:theme`](/guide/topics/manifest/application-element#theme) style resource of your app's `\u003capplication\u003e` element.\n\nTo use a different accent color for your in-car experience, include a\n[`\u003cmeta-data\u003e`](/guide/topics/manifest/meta-data-element) element for a different style resource containing a\n`colorAccent` item: \n\n \u003capplication\u003e\n ...\n \u003cmeta-data\n android:name=\"com.google.android.gms.car.application.theme\"\n android:resource=\"@style/\u003cvar translate=\"no\"\u003eTHEME_NAME\u003c/var\u003e\"/\u003e\n ...\n \u003c/application\u003e\n\nPlatform-specific configuration\n-------------------------------\n\nIn addition to the configuration detailed on this page, see the following\nsections for platform-specific requirements:\n\n- [Add support for Android Auto to your media app](/training/cars/media/auto#manifest-car-app)\n- [Add support for Android Automotive OS to your media app](/training/cars/media/automotive-os#automotive-module)"]]