构建错误Bind_Listener已弃用

时间:2016-04-29 09:02:32

标签: wear-os android-wear-data-api

当我尝试构建我的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

1 个答案:

答案 0 :(得分:11)

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

更新的方法是使用细粒度的intent filter 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>

您可以在documentation上了解更多相关信息。

相关问题