媒体浏览器服务概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以通过扩展受支持的 MediaBrowserServiceCompat
或 MediaLibraryService
类来创建媒体浏览器服务。然后,Android Auto 和 Android Automotive OS (AAOS) 可以使用您的服务执行以下操作:
您还可以使用媒体浏览器服务来允许其他客户端访问应用中的媒体内容。这些媒体客户端可以是用户手机上的其他应用,也可以是其他远程客户端。
目录
以下页面详细介绍了如何使用媒体浏览器:
设计准则
如需详细了解设计准则,请参阅:
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-22。
[null,null,["最后更新时间 (UTC):2025-08-22。"],[],[],null,["# Media browser service overview\n\nYou create a media browser service by extending the supported\n[`MediaBrowserServiceCompat`](/reference/androidx/media/MediaBrowserServiceCompat) or [`MediaLibraryService`](/media/media3/session/serve-content) classes. Android\nAuto and Android Automotive OS (AAOS) can then use your service to:\n\n- Browse your app's content hierarchy to present a menu to the user.\n\n- Get the token for your app's [`MediaSessionCompat`](/reference/android/support/v4/media/session/MediaSessionCompat) object to control\n audio playback.\n\nYou can also use your media browser service to let other clients access media\ncontent from your app. These media clients might be other apps on a user's\nphone, or they can be other remote clients.\n\nContents\n--------\n\nThese pages detail how to work with the media browser:\n\n- [Media browser lifecycle](/training/cars/media/create-media-browsers/workflow)\n- [Build content hierarchy](/training/cars/media/create-media-browser/content-hierarchy)\n- [Apply content styles](/training/cars/media/create-media-browser/content-styles)\n- [Display media artwork](/training/cars/media/create-media-browser/media-artwork)\n- [Display browsable search results](/training/cars/media/create-media-browser/browsable-search)\n- [Implement custom browse actions](/training/cars/media/create-media-browser/custom-browse-actions)\n\nDesign guidelines\n-----------------\n\nTo learn more about design guidelines, see:\n\n- [Plan navigation tabs](https://developers.google.com/cars/design/create-apps/media-apps/navigation-tabs)\n- [Plan browsing views](https://developers.google.com/cars/design/create-apps/media-apps/browsing-views)"]]