checkHealthConnectAvailability method

Future<HealthConnectAvailabilityStatus> checkHealthConnectAvailability()

Check if Health Connect is installed or should be updated.

Possible return values:

notInstalled - The Health Connect SDK is unavailable on this device at the time. This can be due to the device running a lower than required Android Version. Apps should hide any integration points to Health Connect in this case.

updateRequired - The Health Connect SDK APIs are currently unavailable, the provider is either not installed or needs to be updated. Apps may choose to redirect to package installers to find a suitable APK.

installed - The Health Connect SDK APIs are available.

Implementation

Future<HealthConnectAvailabilityStatus> checkHealthConnectAvailability() async {
  if (!Platform.isAndroid) {
    return HealthConnectAvailabilityStatus.notInstalled;
  }

  final result = await NativeSDKBridgeV3.checkHealthConnectAvailability(
    connectionId: connectionId,
  );

  return HealthConnectAvailabilityStatus.fromString(result);
}