Making WearableListenerService onDataChanged() call on every PutDataMapRequest

别说谁变了你拦得住时间么 提交于 2019-12-13 21:10:34

问题


I want WearableListenerService to call onDataChanged() every time I make a request. I am aware that onDataChanged() is only called, well, on data change and not every time.

I can add dummy data with the date to make this happen, but that feels patchy.

Is there a more elegant way to achieve what I want to do?


回答1:


You might be able to turn the situation around a bit. As you say, onDataChanged is only called whenever there's a change and you should probably keep handling that.

Whenever you need to know the current value you can use one of the Wearable.DataApi.getDataItem(s) methods as described on https://developer.android.com/reference/com/google/android/gms/wearable/DataApi.html .



来源:https://stackoverflow.com/questions/27665686/making-wearablelistenerservice-ondatachanged-call-on-every-putdatamaprequest

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!