wear-osandroid-wear-data-apimoto-360

Implementing both DataItem.DataListener interface and WearableListenerService


In Android Wear application i've implemented DataItem.DataListener interface for an Activity. Since i already created WearableListenerService for some other usages. Now the situation is when i want onDatachanged() in MyActivity it will execute onDatachanged() of WearablelistenerService. Also viceversa


Solution

  • I guess you need to use the path (event.getDataItem().getUri().getPath();) to define the recipient or the purpose of the respective data map. Every listener should evaluate certain paths only to avoid confusions.