Open ghost opened 9 years ago
So the content of the DataMaps have the same keys?
I've experience the same situation. Imagine that you have 2 PutDataMapRequest
s: one with "/path1" and second with: "/path2". Each of them contains different DataMaps
with different keys but both have the same key for timestamp. When I want to sync only one DataItem
it sync them both. Because I trigger syncItem() action based on previous syncItem() this syncing goes forever.
I think you need to pass DataMapItem
in OnSyncDataItemTask
instead of DataMap
. Then we can distinguish among different Uri. What do you think?
I resolve it by having two keys for timestamp - "path1_timestamp" and "path2_timestamp". I am always checking if the key is there. Weird...I thought that only specific DataItems
will sync, not all of them. (All callbacks are always called but keys are missing accordingly)
From the source i saw that although you send results back using a seperate DataItem, the library will use its own id to fetch the results. So if you send data using 2 seperate DataItem's (each with different keys) it will get the results using its own identifier. In my case i got mixed results from both, or there would be a delay in fetching the data. Either way it would not displaying the correct result or it would work but mixing the results. Although Google recommends using DataItem for this kind of data, I used the MessageAPI and so far no problems so far.
Im working on sending results from sensors. In this case i have 2 datamaps with sensor data from 2 sensor types. After trying to sync the data to the phone using their own syncdata methods, getting mixed results. From the library using syncAll method, it creates its own PATH and cant distinguish the results from the incoming datamaps.