krokyze / FitKit

Flutter plugin for reading health and fitness data. Wraps HealthKit on iOS and GoogleFit on Android.
BSD 2-Clause "Simplified" License
98 stars 73 forks source link

Steps not match with Google fit app #19

Closed ronguleria closed 4 years ago

ronguleria commented 4 years ago

I Will try to get steps on my app but steps did not match with google fit in android code void healthDatareadAll() async { steps=0; if (await FitKit.requestPermissions(DataType.values)) { for (DataType type in DataType.values) { final results = await FitKit.read( type, DateTime(DateTime.now().year,DateTime.now().month,DateTime.now().day-1,0,0,0,0,0,), DateTime.now().subtract(Duration(days: 1)), ); if (type == DataType.STEP_COUNT) { var stepsMap= results.asMap(); for( int i=0;i<stepsMap.length;i++) { steps=steps+stepsMap[i].value; } Fluttertoast.showToast( msg: steps.toString(), toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.CENTER, timeInSecForIos: 1, backgroundColor: Colors.red, textColor: Colors.white, fontSize: 16.0); } } }

hemanthkaipaa commented 4 years ago

Same here it was not matching with google fit app. Step count is more than what displayed in google fit.

krokyze commented 4 years ago

Hey @ronguleria @hemanthkaipaa it could be that there are some duplicates in the entries and Google Fit just takes one. Can you please verify if dateFrom, dateTo for the entries are unique?

krokyze commented 4 years ago

As of version 0.0.6 extra field source has been implemented for every data object.