0

I am working for an Android-wear application. My goal is to sending continuous data to Handheld device from wear. Luckily I had achieved this using Data Layer api. The problem I am facing here is to sending and syncing the data which wear device has in disconnected mode i.e., data collected when phone and wear are not connected due to any reason.

Please suggest me the way to keep track of data that is not being sent to phone and sending/syncing it whenever connection get established.

GouravJn
  • 246
  • 1
  • 6
  • 18

1 Answers1

0

If you add data using DataApi, it will sync up when connectivity is reestablished so you don't need to do anything manually.

Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28
  • Thanks @Ali for responding. Can you please elaborate a bit more. My concern is that if I am simply showing the transfered data on phone then how can I came to know about the data that is not being transferred during offline mode. – GouravJn Jan 07 '16 at 15:03
  • I am not sure what you mean; if device A is adding some data to sync across the wear network and if device B is disconnected at that point, obviously that device B is not going to have any knowledge of the new data that A has added. What I am saying is that when B and A connect again, the DataApi logic will sync the new data across both devices without you, the developer, need to do anything extra. On each device, you can always find out what other devices/nodes are connected on the wear network at that moment so device B knows A is not connected, in case it needs that info. – Ali Naddaf Jan 07 '16 at 15:48
  • Hi @Ali, Let me define my problem in some different way. I had an increment counter on wear app that is continuously sending incremental value(integer) to phone and phone is showing that received value on screen. And during app run, I turn off and on the Bluetooth again and again. Now I had all the wear data on phone when bluetooth is ON but lost the middle data when it is OFF. Hope I am able to explain this time better. if you had any example or solution please provide me the link. – GouravJn Jan 11 '16 at 12:24
  • You can be informed of the connectivity state by registering appropriate callbacks, then when you lose connectivity, you wold know about it; there is not much more that can be done when you lose connectivity. – Ali Naddaf Jan 11 '16 at 16:48