Health Connect Manager
Functions
Link copied to clipboard
open suspend override fun enableBackgroundDelivery(types: List<HealthDataType>, frequency: HealthUpdateFrequency = HealthUpdateFrequency.Immediate): Result<Unit>
Enable background delivery for the specified types. On iOS, this calls HKHealthStore.enableBackgroundDeliveryForType.
Link copied to clipboard
Link copied to clipboard
open suspend override fun isAuthorized(readTypes: List<HealthDataType>, writeTypes: List<HealthDataType>): Result<Boolean>
Link copied to clipboard
Link copied to clipboard
Check if background delivery for health data is active.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun observeUpdates(types: List<HealthDataType>, callback: (HealthDataType) -> Unit): Result<Unit>
Observe updates for the specified types. On iOS, this sets up an HKObserverQuery. The callback is invoked when new data is available. The callback should trigger a data read and sync.
Link copied to clipboard
Link copied to clipboard
open suspend override fun readData(startTime: Instant, endTime: Instant, type: HealthDataType): Result<List<HealthRecord>>
Link copied to clipboard
open suspend override fun requestAuthorization(readTypes: List<HealthDataType>, writeTypes: List<HealthDataType>): Result<Boolean>
Link copied to clipboard
Link copied to clipboard
Inserts one or more HealthRecord. Insertion of multiple records is executed in a transaction - if one fails, none is inserted.