0

This is how I'm using DataAPI

    PutDataMapRequest dataMapReq = PutDataMapRequest.create(PATH);
    dataMapReq.getDataMap().putFloatArray(KEY, list);
    PutDataRequest putDataReq = dataMapReq.asPutDataRequest();
    Wearable.DataApi.putDataItem(mGoogleApiClient, putDataReq);

list could be an array[] or ArrayList<>. If I add a new element then I'll have to put the list in the data map again. This will cause a retransmission of every previously inserted elements?

user3290180
  • 4,260
  • 9
  • 42
  • 77
  • I suggest you only to send the updates / delta. If the watch wants the full data, it asks it from the phone, only then the phone pushes the full list. – xizzhu Jul 14 '15 at 12:47
  • thanks, so you're not sure that delta won't be automatically recognized to avoid a total retransmission? – user3290180 Jul 14 '15 at 12:54

1 Answers1

1

Yes, if you change an element in the array/list, you need to put another data item and it will replace the old one. That will cause retransmission to the other devices.

In general, I wouldn't worry about that retransmission. Since there is a limit of how much you can send in the DataItem, you are probably not sending too much data. If you are still worried about it, consider partitioning the data and sending several data items (for example send four sub-arrays of floats and merge them on the other side). Do not send each float a separate data item (enormous overhead).

gruszczy
  • 40,948
  • 31
  • 128
  • 181