0

So I found something weird about GoogleApiClient.

That's if you change the handheld's time to future (change it to a few days ahead), then sync some data via DataApi to wearable, then change back to correct time (use Automatic date & time), then sync some data via DataApi again, this time DataListener's onDataChanged which is registered on wearable will NOT be called.

If you change handheld's time to the future time you changed at the first time (or further time in the future), the DataApi works properly again.

So I really want to confirm that it's designed that way or it's just a bug?

P/S: it behaved the same when I tested on both com.google.android.gms:play-services:7.5.0 and com.google.android.gms:play-services:7.8.0

Leo
  • 1,433
  • 23
  • 40
  • onDataCahnged() will be only called if there is change in data which you are transferring. In your case it seems that you changes the device time but your data content which you are transferring is not changed, that's the reason onDataChanged() is not getting called. Best way to deal with it is always send Syste,.currentTimeMillis() as well. This will make sure that content which you are sending is always different from your previous content :) – vicky Aug 19 '15 at 02:57
  • My data content did changed because it was different images, and and I tried the timestamp trick as well but no luck. I think the DataApi heavily relies on `System.currentTimeMillis()`, but I'm not sure. I guess we need a confirmation from the library team.. – Leo Aug 19 '15 at 03:01
  • hmm..If its by design then its interesting :) But not sure purpose behind doing this. – vicky Aug 19 '15 at 03:03
  • I'm not sure, but I also found out that in the WatchFace sample (http://developer.android.com/samples/WatchFace/index.html) they use MessageApi to send data from handheld to wearable instead of the DataApi. Perhaps they have been aware of unstability of the API at the first place... Just my thought though – Leo Aug 19 '15 at 03:09

0 Answers0