Android Wear deleting data on DataApi with deleteDataItems

空扰寡人 提交于 2019-12-22 05:15:15

问题


My question is simple: how to delete data from DataAPI?

I have some data in the path "/model/model_id" and want to delete ALL the data in the "/model".

I use the code:

uri = new Uri.Builder().scheme(PutDataRequest.WEAR_URI_SCHEME).path("model");

PendingResult<DataApi.DeleteDataItemsResult> deleteDataItemsResultPendingResult =
                        Wearable.DataApi.deleteDataItems(mGoogleApiClient, uri);
                deleteDataItemsResultPendingResult.await();

NOTHING HAPPENS on the wear side (the method onDataChanged is never called on the WearableListenerService)

The current documentation for Android Wear is probably the WROST documentation ever made in the history of the universe. Can someone help me?


回答1:


I think this should work

Wearable.DataApi.deleteDataItems(mGoogleApiClient, uri, DataApi.FILTER_PREFIX);




回答2:


There seems to be a bug in the API. I'm pretty sure that deleting data items on the wear side does not work at all (Google API 8.0.3) at least not with the Sony SmartWatch 3 devices I'm using (running Android 5.1.1).

Sending data back and forth is not a problem but the DataItems have to be deleted on the mobile end unfortunately.



来源:https://stackoverflow.com/questions/25430232/android-wear-deleting-data-on-dataapi-with-deletedataitems

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