I'm trying to observe .irregularHeartRhythmEvent using HKObserverQuery.
Code, I'm using to subscribe to this event:
Each time I call this function, I see output in my console:
Also, I havn't any options how to detect if triggered event is fake or not.
Absolutely same situation with .lowHeartRateEvent and .highHeartRateEvent
My app has all allowed accesses to HealthKit.
How can I actually subscribe for such kind of events to track this and notify user?
Code, I'm using to subscribe to this event:
Code Block private func subscribeForAbnormals() { let abnormals = HKCategoryType.categoryType(forIdentifier: .irregularHeartRhythmEvent)! healthStore.enableBackgroundDelivery( for: abnormals, frequency: HKUpdateFrequency.immediate ) { isSuccess, error in let subscriptionStatus = isSuccess ? "OK ✅" : "FAILED ❌" print("Irregular hearbeat subscription status: \(subscriptionStatus)") if let error = error { print(error.localizedDescription) } } let query = HKObserverQuery( sampleType: abnormals, predicate: nil ) { [weak self] _, completionHandler, _ in print("Irregular hearbeat detected") completionHandler() } healthStore.execute(query) }
Each time I call this function, I see output in my console:
According to HealthApp, I have no cases of Irregular Hearth Rhythm.Irregular hearbeat subscription status: OK ✅
Irregular hearbeat detected
Also, I havn't any options how to detect if triggered event is fake or not.
Absolutely same situation with .lowHeartRateEvent and .highHeartRateEvent
My app has all allowed accesses to HealthKit.
How can I actually subscribe for such kind of events to track this and notify user?