0

So I am was using following read request from Sessions API to get steps, distance and calories:

    SessionReadRequest activitySummaryRequest = new SessionReadRequest.Builder()
        .read(DataType.TYPE_STEP_COUNT_DELTA)
        .read(DataType.TYPE_CALORIES_EXPENDED)
        .read(DataType.TYPE_DISTANCE_DELTA)
        .setTimeInterval(startTime, endTime, TimeUnit.MILLISECONDS)
        .readSessionsFromAllApps()
        .build();

This was working for couple of days until it stopped. Neither of onSuccess, onFailure, onComplete listeners were hit and request was just ignored. There was no errors in logcat either. By removing read(DataType.TYPE_DISTANCE_DELTA) from request I was able to get steps and calories. I also have checked if ACCESS_FINE_LOCATION permissions is granted and it was. Also to read this documentation states that following scope was required FITNESS_LOCATION_READ and I have added it too and requested permissions for it if they are not already granted.

Does anyone know what could be an issue with this stopping to work? Is there some additional checks that should be done?

sela
  • 314
  • 1
  • 11
  • Hi @sela, I am facing an oauth issue of 5000 error code - when I request for DataType.TYPE_DISTANCE_DELTA. Were you able to resolve your issue? – Shekhar Suman Mar 31 '21 at 19:16
  • @ShekharSuman Yes that one is for OAuth permission which you need to require for Google Account, basically this https://developers.google.com/android/reference/com/google/android/gms/fitness/FitnessStatusCodes#public-static-final-int-needs_oauth_permissions – sela Apr 01 '21 at 16:14

0 Answers0