Thursday 31 May 2018

How to get WatchOS4 heartRateVariabilitySDNN and it's use?

I am trying to use heartRateVariabilitySDNN. I successfully get heartRate by query and i use following code for get heartRateVariabilitySDNN but have no idea how its works. also there is no any proper documentation about their query or sample code from apple side.
func createheartRateVariabilitySDNNStreamingQuery(_ workoutStartDate: Date) -> HKQuery? {

    let typeHeart = HKQuantityType.quantityType(forIdentifier: .heartRateVariabilitySDNN)
    let predicate: NSPredicate? = HKQuery.predicateForSamples(withStart: workoutStartDate, end: nil,
 options: HKQueryOptions.strictEndDate)

    let squery = HKStatisticsQuery(quantityType: typeHeart!, quantitySamplePredicate: predicate,
 options: .discreteAverage, completionHandler: {(query: HKStatisticsQuery,result: HKStatistics?, 
error: Error?) -> Void in
        DispatchQueue.main.async(execute: {() -> Void in

            print("got: \(String(describing: result))")
        })
    })

    return squery
}



from How to get WatchOS4 heartRateVariabilitySDNN and it's use?

1 comment:

  1. https://www.wizweb.in

    Wizweb Technology is a leading software development company custom website design, software development, SMS Provider, Bulk sms, transactional sms, promotional sms, mobile app development, Hosting Solution, seo(search engine optimization) and Digital marketing etc.

    ReplyDelete