android - Wearable.DataApi.deleteDataItems is not working -


i appreciate insight tried make deletedataitems working doesn't.

i've implemented simple scenario creating new data items (arraylist) in main app , passing on wearable client using data api.

here few code snippets:

  public void syncdataitemsmainapp()   {    if (mgoogleapiclient==null){mgoogleapiclient.connect();}    arraylist<string> mylist;   mylist = new arraylist<string>();    mylist.add(new string(strvalue));   // add different set of values each time anything.    //for simplicity lets assume add "books" , "pens"     putdatamaprequest putdatamapreq = putdatamaprequest.create("/mylistitem");   putdatamapreq.getdatamap().putlong(action_time_stamp, new date().gettime());   putdatamapreq.getdatamap().putstringarraylist("com.myapp.example",mylist);    putdatarequest putdatareq = putdatamapreq.asputdatarequest();   wearable.dataapi.deletedataitems(mgoogleapiclient,putdatamapreq.geturi()); //i use line delete dataitems created in past not want store variables on cloud current ones in mylist   wearable.dataapi.putdataitem(mgoogleapiclient, putdatareq);   } 

here wearable ondatachanged"

  @override   public void ondatachanged(dataeventbuffer dataevents)    {     // todo auto-generated method stub     (dataevent event : dataevents)     {         // dataitem changed         dataitem item = event.getdataitem();          if (event.gettype() == dataevent.type_changed)          {              if (item.geturi().getpath().compareto("/mylistitem") == 0)              {                 datamap datamap = datamapitem.fromdataitem(item).getdatamap();                   arraylist<string> mylistitems =datamap.getstringarraylist("com.myapp.example");                 populatewearablelist(mylistitems);             }         }      }    } 

now problem every time parse arraylist on wearable include values i've ever added array in main app, mentioned above, store last set of values included last call. hence doesn't seem deletedataitems work @ all. interesting thing in debug on bluetooth mode, able see last set of values, once app & wearable connected cloud creates additional instances of same values quite confusing.

any highly appreciated give using dataapi tried already.

i found reason dataapi listener hasn't been stopped while app in background mode. had place data api calls separate wearablelistenerservice , started working fine. wish have been called out somewhere in docs..


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -