title: Define my app as Google Assistant's default music service
body: <p>I am developping an Android Music Player application. I'd like to integrate it with Google Assistant to control playback and search songs by voice.
  I already implemented a Media Session in my app according to instructions from the <a href="https://developer.android.com/guide/topics/media-apps/interacting-with-assistant.html#use_a_media_session" rel="nofollow noreferrer">official documentation</a>.</p>
  
  <p>When requesting the Assistant to play something with my app, I have to say something like "Play <em>some artist</em> on <em>MyApp</em>". When I say "Play <em>some artist</em>", Assistant tells me that I don't have configured a default music provider.</p>
  
  <p>This leads me to the following screen in the Google Assistant app:</p>
  
  <p><a href="https://i.stack.imgur.com/p569f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p569f.png" alt="enter image description here"></a></p>
  
  <p>I note that <em>MyApp</em> is not listed in "Your music services".
  My question is the following: what do I have to change in my app for it to be choosable as the default music service ?</p>
  
  <p>For your information, here is the Manifest file:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      package="fr.nihilus.music"&gt;
  
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
      &lt;uses-feature
          android:name="android.hardware.audio.output"
          android:required="true" /&gt;
  
      &lt;application
          android:name=".NihilusMusicApplication"
          android:allowBackup="true"
          android:fullBackupContent="@xml/backup"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"
          tools:ignore="GoogleAppIndexingWarning"&gt;
  
          &lt;!-- Main activity for music browsing. --&gt;
          &lt;activity
              android:name=".HomeActivity"
              android:launchMode="singleTop"
              android:theme="@style/AppTheme.NoActionBar"&gt;
  
              &lt;!-- Make this Activity visible in launcher --&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
  
              &lt;!-- Make this activity available as the default music app. --&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.APP_MUSIC" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
  
              &lt;!-- Intent filter that enables voice searches, such as "Play the Beatles" --&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
  
              &lt;meta-data
                  android:name="android.app.default_searchable"
                  android:value=".ui.SearchResultActivity" /&gt;
              &lt;meta-data
                  android:name="android.app.shortcuts"
                  android:resource="@xml/shortcuts" /&gt;
          &lt;/activity&gt;
  
          &lt;!-- Activity showing detail and tracks of an album. --&gt;
          &lt;activity
              android:name=".ui.albums.AlbumDetailActivity"
              android:parentActivityName=".HomeActivity"
              android:theme="@style/AppTheme.NoActionBar" /&gt;
  
          &lt;!-- Activity for toggling user preferences. --&gt;
          &lt;activity
              android:name=".settings.SettingsActivity"
              android:label="@string/action_settings"
              android:parentActivityName=".HomeActivity" /&gt;
  
          &lt;!--
              Activity to be opened as a dialog window when a track is selected
              from the file explorer.
           --&gt;
          &lt;activity android:name=".FileViewerActivity"
              android:theme="@style/AppTheme.FileViewer"
              android:excludeFromRecents="true"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.VIEW" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
  
                  &lt;data
                      android:mimeType="audio/*"
                      android:scheme="content" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;!--
              Main music service, provides media browsing and media playback services to
              consumers through MediaBrowserService and MediaSession. Consumers connect to it through
              MediaBrowser (for browsing) and MediaController (for play session control)
          --&gt;
          &lt;service
              android:name=".service.MusicService"
              android:exported="true"
              android:label="@string/playback_service_label"
              android:process=":musicplayer"
              tools:ignore="ExportedService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.media.browse.MediaBrowserService" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;!--
              A receiver that will receive media buttons and send as intents to MusicService.
              Required on pre-Lollipop.
          --&gt;
          &lt;receiver android:name="android.support.v4.media.session.MediaButtonReceiver"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MEDIA_BUTTON" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>