Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Wear and Google Fit: How to force update of datasets between smartwatch and smartphone?

From the smartphone by using HistoryAPI If I ask for user's history and DataType.TYPE_HEART_RATE_BPM for the last past hour, starting from the current time, I miss data from the last half hour.

If I ask them to Google Fit with the same procedure from the smartwatch it's all fine.

So it's not a matter of data fetching because it depends on device.

Maybe it's a problem of synchronization? How do I programmatically force an update of records in the repository of Google Fitness Store?

This is what I'm talking about.

EDIT: this is how I build a request

      DataReadRequest readRequest = new DataReadRequest.Builder()
            .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
            .enableServerQueries()
            .read(dataType)
            .build();
like image 855
user3290180 Avatar asked Jul 01 '15 14:07

user3290180


1 Answers

Have you given the devices enough time to synchronize all data before making a request? When you request data from the HistoryAPI on the phone it will be fetched from the cloud. However, when you request data from the watch it will only be local data from that wearable device. If the devices have been out of range I assume that it would take some time, after re-connecting, before the watch data is available in the cloud. As far as I know there's no way of forcing such an update to happen faster/on demand.

A possible workaround would be to check the time stamp of the data points and use local data on the watch if there's data missing from the request made on the phone.

like image 165
TofferJ Avatar answered Sep 18 '22 12:09

TofferJ