Android Wear deletes DataApi data with deleteDataItems

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

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

I am using 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 passes on the wear side (the onDataChanged method is never called in the WearableListenerService)

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

+6
source share
2 answers

I think this should work

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

+2
source

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

Sending data back and forth is not a problem, but unfortunately DataItems must be deleted on mobile devices.

0
source

Source: https://habr.com/ru/post/974163/


All Articles