Search code examples
wear-osgoogle-data-apiandroid-wear-data-api

How can I distinguish whether my onDataChanged was triggered by handheld or wear?


How can I distinguish whether my data was edited on my handheld or on my wear?

According to the docs:

You can listen for the following events with WearableListenerService:

onDataChanged() - Called when data item objects are created, changed, 
or deleted. An event on one side of a connection 
triggers this callback on both sides.

I'm using the service, but want to ignore the items, if they are edited on the handheld, and only want


Solution

  • I ended up using the NodeApi.getLocalNode():

    https://developers.google.com/android/reference/com/google/android/gms/wearable/NodeApi