Media browser service lifecycle

This section describes how Android Automotive OS (AAOS) and Android Auto interact with your media browser service during a typical user workflow:

  1. The user launches your app on AAOS or Android Auto.

  2. The host app binds to your media browser service, which the OS starts if it isn't already running. In your implementation of the onCreate() method, you must create and register a MediaSessionCompat object and its callback object. To learn more, see Register a media session.

  3. AAOS or Android Auto calls your service's onGetRoot method to retrieve the root in your content hierarchy. The root is not displayed. Instead, it retrieves more content from your app in subsequent steps.

  4. AAOS or Android Auto calls your service's onLoadChildren() method to retrieve the descendants of the root media item. AAOS and Android Auto display these media items as the top level of content items. See Structure the root menu to learn more about what the system expects.

  5. When the user selects a browsable media item, your service's onLoadChildren() method is called again.

  6. If the user selects a playable media item, AAOS or Android Auto calls the appropriate media session callback method to perform the action.

  7. If supported by your app, the user can also search your content. In this case, AAOS or Android Auto call your service's onSearch() method. To learn more, see Display browsable search results.