0

I am using the Wear DataAPI for the first time now. I couldn't find in the documentaton whether the DataAPI actually checks for differences in the given DataItems everytime you put a "putDataRequest" or just sends over the object you give it.

The thing is: I want to keep a collection in sync that has several (small) images and other stuff. With the dataApi, this would be very easy to handle (especially corner cases, where the wear isn't in range for a short period of time etc. in comparison to the message-API), but I generally don't want to send over the whole collection everytime the data changes, as this can happen quite frequently.

any input on this one? I bet a lot of people have similar issues and already made up their mind about this topic :)

Aeefire
  • 888
  • 10
  • 25

1 Answers1

0

The Data Api will only resend a DataItem if it changes. If you split your collections into individual DataItems and then update them, only the one that changed will by sent over.

However, keep in mind two things when splitting a collection into DataItems:

  1. Keep your DataItems path set stable. If you use paths like path/1, path/2, path/3 .. and always growing the index, it will become a problem for the data item garbage collection. Reuse paths as much possible.
  2. If your collection is very large, consider merging sub-ranges of the collection into DataItems, to you don't send too many of them.

And finally: are you sure you can't have the whole collection inside a single DataItem and just update it? If only small number of items change in your collection, maybe you can just split the collection into a fixed number of DataItem objects and send these instead?

gruszczy
  • 40,948
  • 31
  • 128
  • 181