2

I'd like to use the Google Fit Sensors API to read Sensor data from an Android device. However, I don't want to require that the user have an internet connection to enable it.

From my testing, it appears that any time you want to do anything with Sensors, you must have a connected instance of a GoogleApiClient.

public abstract PendingResult<DataSourcesResult> findDataSources (GoogleApiClient client, DataSourcesRequest request)

When I authenticate with a connected GoogleApiClient, I was then able to kill my internet connection and continue to receive sensor data. However, after some period of time, I was no longer able to receive sensor data unless I reconnected my GoogleApiClient (turned data back on). I have a use case where access to data cannot be guaranteed.

Is there a way to use the Sensors API reliably, but without an internet connection?

1 Answers1

0

I use SensorsApi and HistoryApi to get data and it seems to be working fine even when there is not internet connection. Connection is required only when the user signs-in for the first time.

Are you using enableServerQueries ()? This method requires internet connection because it directly requests the Google Fit server to fetch query results.

Ramya Ramesh
  • 299
  • 3
  • 18