簡體   English   中英

將我的應用定義為Google智能助理的默認音樂服務

[英]Define my app as Google Assistant's default music service

我正在開發Android音樂播放器應用程序。 我想將其與Google智能助理集成,以控制播放和按語音搜索歌曲。 我已根據官方文檔中的說明在我的應用中實現了媒體會話。

當請求助理使用我的應用程序播放內容時,我不得不說“在MyApp上播放一些藝術家 ”之類的內容。 當我說“播放一些藝術家 ”時,助理告訴我我沒有配置默認音樂提供商。

這會將我引導至Google智能助理應用中的以下屏幕:

在此輸入圖像描述

我注意到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>

目前,Google助理允許列表中的某些合作伙伴應用。 對伙伴我不確定你做了什么。 如果您是大型音樂提供商公司之一,那么您可能已經擁有了Google Business Development代表,他們應該能夠將您與合適的人聯系起來。

如果您尚未以某種方式與Google保持聯系,則此頁面上有各種聯系方式: https//developers.google.com/actions/在“從第一天獲得您需要的支持”部分。 我會嘗試或更多這些,希望能讓你找到合適的團隊。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM