2

I'm encountering a very weird scenario. I implemented both WearableListenerService and Wearable.DataApi.addListener on my wear device, and I am periodically sending data updates from my phone. The WearableListenerService is properly getting onDataChanged callbacks, but my listener in the main activity isn't..

This is my setup for the activity:

onStart() {
    super.onStart();
    googleApiClient.connect();
}

onStop() {
    googleApiClient.disconnect();
    Wearable.DataApi.removeListener(googleApiClient, this);
    super.onStop();
}

onConnected() {
    Wearable.DataApi.addListener(googleApiClient, this);
}

onDataChanged() {
    // never gets called
}

I can post more code, but above is the general gist. On the other hand, my WearableListenerService is properly declared in the AndroidManifest, and simply prints out logs when it receives onDataChanged.

Is there anything obvious I'm missing here?

Jin
  • 6,055
  • 2
  • 39
  • 72

1 Answers1

0

For this you will have to implement one of the following interfaces in your activity:

  • DataApi.DataListener
  • MessageApi.MessageListener
  • NodeApi.NodeListener

See 'With a Listener Activity' part of this android developer documentation.