Android Fitness.getSessionsClient did not response data

26 Views Asked by At

I'm trying to read data from Google Fit and have a problem when GoogleFit did not response the data.

Ref: https://support.google.com/fit/thread/101350274/working-with-sessions?hl=en

At first it has worked without any issues and it suddenly stopped working for our users. This is very frustrating as there is no any kind of an error from Google Fit library. Neither of callbacks were hit (onSuccess, onFailure, onComplete or onCanceled) so our progress bar is just spinning for users who had got in this case.

We are using 19.0.0. version of Google Fit's library for Android. Code for fetching sessions data is following:

val builder = SessionReadRequest.Builder()
    .readSessionsFromAllApps()
    .enableServerQueries()
    .setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
    .read(DataType.TYPE_STEP_COUNT_DELTA)
    .read(DataType.TYPE_CALORIES_EXPENDED)
    .read(DataType.TYPE_DISTANCE_DELTA)
    .build()

Fitness.getSessionsClient(activity, account)
    .readSession(request)
    .addOnSuccessListener {
        // handle response
    }
    .addOnFailureListener {
      // handleError
    }

where startTime is 14 days ago and endTime is basically moment of making request. We have ensured that Location and Activity Recognition (Physical activity) permissions are granted at runtime for our app

Please help me if you experience on it.

0

There are 0 best solutions below