Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Wear deleting data on DataApi with deleteDataItems

Tags:

java

android

uri

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?

like image 245
Daniel Oliveira Avatar asked Aug 21 '14 15:08

Daniel Oliveira


1 Answers

I think this should work

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

like image 179
dzeikei Avatar answered Oct 15 '22 01:10

dzeikei