diff --git a/packages/health/android/build.gradle b/packages/health/android/build.gradle index d51bb9f96..baadc8e0c 100644 --- a/packages/health/android/build.gradle +++ b/packages/health/android/build.gradle @@ -5,7 +5,7 @@ buildscript { ext.kotlin_version = '1.8.0' repositories { google() - jcenter() + mavenCentral() } dependencies { @@ -17,7 +17,7 @@ buildscript { rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt b/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt index 12c66e0f7..26faacfb7 100644 --- a/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt +++ b/packages/health/android/src/main/kotlin/cachet/plugins/health/HealthPlugin.kt @@ -1936,11 +1936,15 @@ class HealthPlugin(private var channel: MethodChannel? = null) : WORKOUT -> throw IllegalArgumentException("You must use the [writeWorkoutData] API ") else -> throw IllegalArgumentException("The type $type was not supported by the Health plugin or you must use another API ") } + Log.i("HealthConnect", "Record: $record") scope.launch { try { healthConnectClient.insertRecords(listOf(record)) + Log.i("HealthConnect2", "Record: $record") + result.success(true) } catch (e: Exception) { + Log.i("HealthConnect2", "Record: $e.message") result.success(false) } } diff --git a/packages/health/example/android/app/src/main/AndroidManifest.xml b/packages/health/example/android/app/src/main/AndroidManifest.xml index 6e27ac6e0..1394755ba 100644 --- a/packages/health/example/android/app/src/main/AndroidManifest.xml +++ b/packages/health/example/android/app/src/main/AndroidManifest.xml @@ -49,6 +49,14 @@ + + + + + + + + { // Both Android's Google Fit and iOS' HealthKit have more types that we support in the enum list [HealthDataType] // Add more - like AUDIOGRAM, HEADACHE_SEVERE etc. to try them. bool success = true; + /* success &= await health.writeHealthData( 1.925, HealthDataType.HEIGHT, earlier, now); success &= @@ -168,6 +169,16 @@ class _HealthAppState extends State { 0.0, HealthDataType.SLEEP_AWAKE, earlier, now); success &= await health.writeHealthData( 0.0, HealthDataType.SLEEP_DEEP, earlier, now); + */ + + success &= await health.writeHealthData( + 50.0, HealthDataType.RESTING_HEART_RATE, earlier, now); + + success &= await health.writeHealthData( + 50, HealthDataType.FLIGHTS_CLIMBED, earlier, now); + + success &= await health.writeHealthData( + 50, HealthDataType.BASAL_ENERGY_BURNED, earlier, now); // Store an Audiogram // Uncomment these on iOS - only available on iOS diff --git a/packages/health/example/lib/util.dart b/packages/health/example/lib/util.dart index 1cef17604..725f85a48 100644 --- a/packages/health/example/lib/util.dart +++ b/packages/health/example/lib/util.dart @@ -51,6 +51,7 @@ const List dataTypesIOS = [ /// List of data types available on Android const List dataTypesAndroid = [ HealthDataType.ACTIVE_ENERGY_BURNED, + HealthDataType.BASAL_ENERGY_BURNED, HealthDataType.BLOOD_GLUCOSE, HealthDataType.BLOOD_OXYGEN, HealthDataType.BLOOD_PRESSURE_DIASTOLIC, @@ -72,4 +73,6 @@ const List dataTypesAndroid = [ HealthDataType.SLEEP_SESSION, HealthDataType.WATER, HealthDataType.WORKOUT, + HealthDataType.RESTING_HEART_RATE, + HealthDataType.FLIGHTS_CLIMBED, ];