Technical docs‎ > ‎

Replace BIND_LISTENER for Android Wear apps








Android Studio (and Android Lint running during Gradle builds) will flag any usages of com.google.android.gms.wearable.BIND_LISTENER as an error:

AndroidManifest.xml:11: Error: The com.google.android.gms.wearable.BIND_LISTENER action is deprecated. [WearableBindListener]
                  <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 errors, 0 warnings

If your phone or wear app is using the BIND_LISTENER action, you should update your app to use one of the newer, more fine-grained actions below. You must also update to play-services-wearable version 8.2 or later.


To listen to data items and messages on a path of /prefix, the new syntax looks like this:


<service android:name=".ExampleWearableListenerService">
    <intent-filter>
        <action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
        <action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
        <data android:scheme="wear" android:host="*" android:pathPrefix="/prefix" />
    </intent-filter>
</service>

Not this:

<service android:name=".ExampleWearableListenerService">
    <intent-filter>
        <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
    </intent-filter>
</service>

Comments