OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
341 stars 68 forks source link

Fitness.getSleepAnalysis(dateSleep) returns empty array #99

Open patriksharma opened 3 years ago

patriksharma commented 3 years ago

I don't know what can be a reason here but getSteps is working fine and I'm getting steps from start to end date but not in case I try to get sleep analysis , any idea what can be a reason ?

 let dateSleep = 
      {startDate: '2020-04-01', endDate:'2021-04-19' };
 Fitness.getSleepAnalysis(dateSleep)
        .then((records) => {
          console.log("here came",records)
          //console.log("here",Fitness.SleepAnalysis.records)
          // Do something
        })
        .catch((error) => {
          console.log("here",error)
          // Do something
        });
      }
djochim commented 2 years ago

We are facing the same issue. @patriksharma were you able to fix it?

pancr9 commented 2 years ago

Seeing the same issue. Getting empty array at https://github.com/OvalMoney/react-native-fitness/blob/fd9c38540540ef5fdfd372e030c52e8a7ffd7052/android/src/main/java/com/ovalmoney/fitness/manager/Manager.java#L417. Possibly something changed on the Google Fit side?