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

Must specify a valid bucketing strategy while requesting aggregation #7

Open nielstj opened 5 years ago

nielstj commented 5 years ago

Thanks for writing this plugin.

I encounter Platform exception when trying to fetch steps data with this code :

final start = startOfDay(date);
final end = endOfDay(date);
final data = await FitKit.read(DataType.STEP_COUNT, start, end);

The exception

 PlatformException(FitKit, Must specify a valid bucketing strategy while requesting aggregation, null)

Tried solution from here, by removing bucketByTime(...), no exception thrown, but results always empty or 0.

Is this a problem with the data aggregation? Thanks in advance.

krokyze commented 5 years ago

Hey @nielstj

Sorry for the late reply. Did you already manage to solve this issue? What's the start/end dates?

nielstj commented 5 years ago

No, I haven't resolve it yet. Start is the beginning of a day at 00.00 and end is the end of day at 23.59.