StasDoskalenko / react-native-google-fit

A React Native bridge module for interacting with Google Fit
MIT License
333 stars 209 forks source link

How to get active minutes(move minutes) ? #232

Closed uday169 closed 3 years ago

uday169 commented 3 years ago

How can I get active minutes ..please help.

aboveyunhai commented 3 years ago

@uday169 what exactly is active minutes? examples?

uday169 commented 3 years ago

active Minutes, which you earn through doing activities that get you moving like walking, running...It also called move minutes. gfit

aboveyunhai commented 3 years ago

It seems like there is a data type relates to it. So it need to be implemented as a new feature. There are so many datatype from the Api, I wish I could make an universal way to get the data depends on user input datatype. But I'm currently busy on other stuffs.

uday169 commented 3 years ago

Actually, it's important to us to get that data. I'm trying to fix this.. If you suggest me something. Thank you so much for your help...

aboveyunhai commented 3 years ago

Actually, it's important to us to get that data. I'm trying to fix this.. If you suggest me something. Thank you so much for your help...

I believe you can either add a getActitity or getActivityByType function from this file

https://github.com/StasDoskalenko/react-native-google-fit/blob/365de230b6114316688e41404e177cc82b288275/android/src/main/java/com/reactnative/googlefit/ActivityHistory.java#L36

https://developers.google.com/fit/datatypes/activity#move_minutes

I hadn't look at the file in details, feel free to ask any question.

nabarun1995 commented 3 years ago

How I get active minutes .help please...

uday169 commented 3 years ago

Actually, it's important to us to get that data. I'm trying to fix this.. If you suggest me something. Thank you so much for your help...

I believe you can either add a getActitity or getActivityByType function from this file

https://github.com/StasDoskalenko/react-native-google-fit/blob/365de230b6114316688e41404e177cc82b288275/android/src/main/java/com/reactnative/googlefit/ActivityHistory.java#L36

https://developers.google.com/fit/datatypes/activity#move_minutes

I hadn't look at the file in details, feel free to ask any question.

Hii @aboveyunhai, Any status of this feature or when you will be working on it...

aboveyunhai commented 3 years ago

@uday169 Just figure out how to get move minute via rest api. So I can verify the Android Api implementation . Since the documentation from Google Fit was somehow confusing, there were not a lot of sources I can rely on. You need to be patient and it's Open Source no matter what.

uday169 commented 3 years ago

Thank you @aboveyunhai for the update... I found an error on move minutes documentation in the readme file, instead of getMoveMinutes() there is getSleepSamples(). Please check it, and thank you so much again for the update.

DanielCarrascoFalcon commented 3 years ago

Hello! First of all thanks for your amazing work guys!! I tried to use this function but got an 'undefined error':

TypeError: _reactNativeGoogleFit.default.getMoveMinutes is not a function. 
(In '_reactNativeGoogleFit.default.getMoveMinutes(opt)', '_reactNativeGoogleFit.default.getMoveMinutes' is undefined)

My code is:

const test = () => {
    let opt = {
      startDate: new Date(moment().startOf('day')).toISOString(),
      endDate: new Date(moment().endOf('day')).toISOString(),
      // bucketUnit: 'DAY', // optional - default "DAY". Valid values: "NANOSECOND" | "MICROSECOND" | "MILLISECOND" | "SECOND" | "MINUTE" | "HOUR" | "DAY"
      bucketUnit: 'MINUTE', // optional - default "DAY". Valid values: "NANOSECOND" | "MICROSECOND" | "MILLISECOND" | "SECOND" | "MINUTE" | "HOUR" | "DAY"
      // bucketInterval: 1, // optional - default 1.
      bucketInterval: 15, // optional - default 1.
    };
    GoogleFit.getMoveMinutes(opt).then((res) => {
      console.log('debug', res);
    });
  }; 

All other functions are working properly, I guess it could be an export issue or something like that but was checking the pull request and everything look fine... Any idea of the problem source?

Version: 0.16.2 React: 16.3.1 React Native: 0.63.4

aboveyunhai commented 3 years ago

@DanielCarrascoFalcon version is just bumped. It needed be published to latest version by @StasDoskalenko