构建错误Bind_Listener已弃用

Rei*_*ica 7 android-wear-data-api wear-os

当我尝试构建我的apk时,它给了我错误的说法

错误:(190)错误:不推荐使用com.google.android.gms.wearable.BIND_LISTENER操作.

这是我的AndroidManifest现在的样子

    <service
        android:name=".MyDeviceListenerService"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action
                android:name="com.google.android.gms.wearable.BIND_LISTENER"/>
        </intent-filter>
    </service
Run Code Online (Sandbox Code Playgroud)

Rei*_*ica 11

自Play Services 8.2起,Bind_Listener已被弃用.

更新的方法是通过仅指定要通知的事件来使用细粒度的intent过滤器API.

要始终从应用程序获取消息,请更改Bind_Listener为此类内容

<service
    android:name=".MyDeviceListenerService"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
        <data android:scheme="wear" android:host="*" android:pathPrefix="/request-network" />
    </intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)

您可以在文档中阅读更多相关信息.