I am trying the dataitem APi and here is my code
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.Co
If you are using DataApi.DataListener, then you have to addListener after GoogleApiClient connected. Something like: Wearable.DataApi.addListener(mGoogleApiClient, this)
inside your GoogleApiClient.ConnectionCallbacks
.
If you are using WearableListenerService make sure you have similar code in your AndroidManifest.xml on the receiving/listening side as shown below:
android:pathPrefix="/YourDataMapPathPrefix"/>
Also keep in mind that onDataChanged
will get call only if the data is ACTUALLY changed. Let's said that the old data is ("Person", "Bob") and you replace it with same data ("Person", "Bob"), then onDataChanged
will not get triggered since the data does not change in fact. But onDataChanged
will get triggered if you put ("Person", "Bob2") instead.