There are two things you can check:
packageName
of the wear app should be identical to packageName
of the device app
onDataChanged()
gets only called when the data really changes. If you put the same data into the DataApi multiple times, the method is only called once until you write different data. You could add a timestamp to the data to make sure that the method gets called once for each write operation. However, using the DataApi is potentially more expensive in terms of battery usage than sending a message. So if you just want to trigger an action after putting data into the DataApi, simply send a message when you are done.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…