Android 将我的应用程序定义为Google Assistant';s的默认音乐服务

Android 将我的应用程序定义为Google Assistant';s的默认音乐服务,android,actions-on-google,android-music-player,assistant,Android,Actions On Google,Android Music Player,Assistant,我正在开发一个Android音乐播放器应用程序。我想将它与谷歌助手集成,通过语音控制播放和搜索歌曲。 我已经在我的应用程序中根据来自的说明实现了媒体会话 当要求助手使用我的应用程序播放某些内容时,我必须说“在我的应用程序上播放一些艺术家”。当我说“播放一些艺术家”时,助手告诉我,我没有配置默认的音乐提供商 这将引导我进入Google Assistant应用程序中的以下屏幕: 我注意到MyApp没有列在“您的音乐服务”中。 我的问题是:我必须在我的应用程序中更改什么才能选择它作为默认音乐服务 以

我正在开发一个Android音乐播放器应用程序。我想将它与谷歌助手集成,通过语音控制播放和搜索歌曲。 我已经在我的应用程序中根据来自的说明实现了媒体会话

当要求助手使用我的应用程序播放某些内容时,我必须说“在我的应用程序上播放一些艺术家”。当我说“播放一些艺术家”时,助手告诉我,我没有配置默认的音乐提供商

这将引导我进入Google Assistant应用程序中的以下屏幕:

我注意到MyApp没有列在“您的音乐服务”中。 我的问题是:我必须在我的应用程序中更改什么才能选择它作为默认音乐服务

以下是清单文件供您参考:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="fr.nihilus.music">

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <uses-feature
        android:name="android.hardware.audio.output"
        android:required="true" />

    <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">

        <!-- Main activity for music browsing. -->
        <activity
            android:name=".HomeActivity"
            android:launchMode="singleTop"
            android:theme="@style/AppTheme.NoActionBar">

            <!-- Make this Activity visible in launcher -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <!-- Make this activity available as the default music app. -->
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.APP_MUSIC" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

            <!-- Intent filter that enables voice searches, such as "Play the Beatles" -->
            <intent-filter>
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

            <meta-data
                android:name="android.app.default_searchable"
                android:value=".ui.SearchResultActivity" />
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/shortcuts" />
        </activity>

        <!-- Activity showing detail and tracks of an album. -->
        <activity
            android:name=".ui.albums.AlbumDetailActivity"
            android:parentActivityName=".HomeActivity"
            android:theme="@style/AppTheme.NoActionBar" />

        <!-- Activity for toggling user preferences. -->
        <activity
            android:name=".settings.SettingsActivity"
            android:label="@string/action_settings"
            android:parentActivityName=".HomeActivity" />

        <!--
            Activity to be opened as a dialog window when a track is selected
            from the file explorer.
         -->
        <activity android:name=".FileViewerActivity"
            android:theme="@style/AppTheme.FileViewer"
            android:excludeFromRecents="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />

                <data
                    android:mimeType="audio/*"
                    android:scheme="content" />
            </intent-filter>
        </activity>

        <!--
            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)
        -->
        <service
            android:name=".service.MusicService"
            android:exported="true"
            android:label="@string/playback_service_label"
            android:process=":musicplayer"
            tools:ignore="ExportedService">
            <intent-filter>
                <action android:name="android.media.browse.MediaBrowserService" />
            </intent-filter>
        </service>

        <!--
            A receiver that will receive media buttons and send as intents to MusicService.
            Required on pre-Lollipop.
        -->
        <receiver android:name="android.support.v4.media.session.MediaButtonReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MEDIA_BUTTON" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

谷歌助手目前允许列表中的某些合作伙伴应用。我不知道你到底在做什么。如果你在一家大型音乐提供商公司工作,你可能已经有了一位谷歌业务发展代表,他应该能够为你找到合适的人


如果你还没有与谷歌取得联系,那么在这个页面上有各种联系方式:在“从第一天获得所需的支持”部分。我会尝试一个或多个,希望这能让你进入正确的团队。

嘿,你运气好吗?我和你走的是同一条路。@Fabio因为我的应用程序只用于播放本地媒体,所以我没有联系谷歌将其作为音乐提供商,因此它没有被列出。但是你仍然可以让助手用如下查询在你的应用程序中搜索内容:
在myapp上玩foo
。我注意到,如果其MediaSession是最新的活动会话,则不必指定应用程序名称。告诉我这对你是否有效。即使用这个短语也不行。您在哪里定义“myapp”,它是清单上的android:label=“myapp”吗?你还需要设置深层链接吗?我还努力让助手知道我的应用程序。助手似乎不识别调试APK,您必须将其发布在Google Play上(也许签名就足够了)。应用程序名称定义为
清单节点的
android:label
。您还必须定义了导出的
android.media.browse.MediaBrowserServiceintent-filter。您是否确认助手仅在已发布的应用程序上工作@法比奥,蒂堡。我似乎无法让我的应用程序与调试助理和已签名的apk一起工作。