Closed carlleeswanson closed 4 years ago
I got the exact same error.
HKQuantityTypeIdentifier' has no member 'appleStandTime', on the Extensions.swift file
Also android raises error with the same comment. STAND_TIME
Same here.
PlatformException(FitKit, type stand_time is not supported, null) - on Android device. Any idea?
@janosdupai @softmarshmallow @carlleeswanson
In the example folder it has this line,
permissions = await FitKit.requestPermissions(DataType.values);
It doesn't work on Android because Standtime is not supported. The README.md shows the supported types.
DataType.values is a List
The way to go about this, is to declare a new list and then pass in these values instead for Android.
List<DataType> androidValues = [
DataType.ENERGY,
//DataType.EXERCISE_TIME,
DataType.DISTANCE,
DataType.STEP_COUNT,
DataType.WATER,
DataType.WEIGHT,
DataType.HEIGHT,
DataType.HEART_RATE,
//DataType.STAND_TIME,
];
permissions = await FitKit.requestPermissions(androidValues);
Starting from version 1.1.2 it's advised to wrap all read methods inside try catch as FitKit.read
will throw specific UnsupportedException
void read() async {
try {
final results = await FitKit.read(
DataType.HEART_RATE,
dateFrom: DateTime.now().subtract(Duration(days: 5)),
dateTo: DateTime.now(),
);
} on UnsupportedException catch (e) {
// thrown in case e.dataType is unsupported
}
}
The addition of "STAND_TIME" appears to have made this package incompatible with iOS 12.4 (presumably other older iOS versions also).
FitKit.requestPermissions(DataType.values) always throws the following error: PlatformException(FitKit, Error type "stand time" is not supported, null)
Removing "STAND_TIME" from fit_kit.dart solves the problem. Oddly, "EXERCISE_TIME" doesn't generate an error.