简体   繁体   中英

Android Wear deleting data on DataApi with deleteDataItems

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?

我认为这应该有效

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM