Open koenmuilwijk opened 1 year ago
@koenmuilwijk Did you ever figure out a work-around?
@owjoh not really, no.
I have this hacky workaround which is far from perfect. However, this library seems not able to work in production atm (see the other ticket on that) so that's the next show stopper you'll run into.
static installHealthConnect() async {
//return HealthConnectFactory.installHealthConnect();
launchUrl(
Uri.parse("market://details?id=com.google.android.apps.healthdata"),
mode: LaunchMode.externalApplication,
);
}
And then wrap the isApiSupported
and isAvailable
into try-catch's.
Any updates on This?
When Google Health Connect is not installed on the device the plugin gives the following exception when calling any method (including the
HealthConnectFactory.isApiSupported()
method. I verified this same behaviour happens in the provided example app.This is because there is no activityContext available while this is asserted on line 71 in
FlutterHealthConnectPlugin.kt
.I believe the correct behaviour would be to not require the activityContext for the following method calls:
isApiSupported
,isAvailable
, andinstallHealthConnect
.