BEHealthKit 1.11
A HealthKit plugin for Unity
Loading...
Searching...
No Matches
Instance Methods | List of all members
BEHealthKit(read) Category Reference

Methods for reading health data. More...

Detailed Description

Read methods for the primary between Unity & the native HealthKit API.

Instance Methods

(void) - readSamples:fromDate:toDate:resultsHandler:
 read quantity, category or correlation samples.
 
(void) - readCharacteristic:resultsHandler:
 read a characteristic.
 
(void) - readSamplesForWorkoutActivity:fromDate:toDate:resultsHandler:
 read workout samples
 
(void) - readStatisticsForQuantityType:predicate:options:resultsHandler:
 perform a statistics query
 
(void) - readStatisticsCollectionForQuantityType:predicate:options:anchorDate:intervalComponents:resultsHandler:
 read health statistics collection
 
(void) - readDocumentOfType:predicate:limit:sortDescriptors:includeDocumentData:resultsHandler:
 read health document
 
(void) - beginBackgroundObserverQuery:
 begins a background observer query
 

Method Documentation

◆ beginBackgroundObserverQuery:

- (void) beginBackgroundObserverQuery: (HKQuantityTypeIdentifier) identifierString

Begins an HKAnchoredObjectQuery HKDocumentQuery for the specified data type.

Parameters
identifierStringthe data type

◆ readCharacteristic:resultsHandler:

- (void) readCharacteristic: (HKCharacteristicType *) characteristic
resultsHandler: (void(^)(id result, NSError *error)) resultsHandler 

Characteristics are things that don't change over time, like blood type or birth date.

Parameters
characteristicThe characteristic to read.
resultsHandlerCalled when the query finishes executing. If unsuccessful, error contains information about what went wrong, otherwise it will be set to nil.

◆ readDocumentOfType:predicate:limit:sortDescriptors:includeDocumentData:resultsHandler:

- (void) readDocumentOfType: (HKDocumentType *) documentType
predicate: (NSPredicate *) predicate
limit: (NSUInteger) limit
sortDescriptors: (NSArray<NSSortDescriptor *> *) sortDescriptors
includeDocumentData: (BOOL) includeDocumentData
resultsHandler: (void(^)(id result, BOOL done, NSError *error)) resultsHandler 

A query that returns a snapshot of all matching documents currently saved in the HealthKit store. See HKDocumentQuery.

Parameters
documentTypeCurrently, only HKDocumentTypeIdentifierCDA is supported.
predicatea predicate that limits the results of the query
limitthe maximum number of documents to return
sortDescriptorsan array of sort decsriptors
includeDocumentDatasend true to include all document data. send false to just return a summary.
resultsHandlerCalled when the query finishes executing. If unsuccessful, error contains information about what went wrong, otherwise it will be set to nil.

◆ readSamples:fromDate:toDate:resultsHandler:

- (void) readSamples: (HKSampleType *) sampleType
fromDate: (NSDate *) startDate
toDate: (NSDate *) endDate
resultsHandler: (void(^)(NSArray *results, NSError *error)) resultsHandler 

Executes a query with -initWithSampleType:predicate:limit:sortDescriptors:resultsHandler:. Limit will be set to no limit, and they will be sorted by startDate, in ascending order.

Parameters
sampleTypethe type of sample to read.
startDatethe starting limit for the query.
endDatethe end date.
resultsHandlerCalled when the query finishes executing. If unsuccessful, error contains information about what went wrong, otherwise it will be set to nil.

◆ readSamplesForWorkoutActivity:fromDate:toDate:resultsHandler:

- (void) readSamplesForWorkoutActivity: (HKWorkoutActivityType) activity
fromDate: (NSDate *) startDate
toDate: (NSDate *) endDate
resultsHandler: (void(^)(NSArray *results, NSError *error)) resultsHandler 

...

Parameters
activityThe activity type to read. See HKWorkoutActivityType documentation
startDatethe starting limit for the query.
endDatethe end date.
resultsHandlerCalled when the query finishes executing. If unsuccessful, error contains information about what went wrong, otherwise it will be set to nil.

◆ readStatisticsCollectionForQuantityType:predicate:options:anchorDate:intervalComponents:resultsHandler:

- (void) readStatisticsCollectionForQuantityType: (HKQuantityType *) quantityType
predicate: (NSPredicate *) predicate
options: (HKStatisticsOptions) options
anchorDate: (NSDate *) anchorDate
intervalComponents: (NSDateComponents *) interval
resultsHandler: (void(^)(id result, NSError *error)) resultsHandler 

A query that performs multiple statistics queries over a series of fixed-length time intervals, and returns the results. See HKStatisticsCollectionQuery

Parameters
quantityTypethe type of sample to read.
predicatea predicate that limits the results of the query
optionsa single option that defines the type of calculation to be performed on the data
anchorDatethe anchor date for the collection's time intervals
intervalthe date components that determine the time interval for each statistic in this collection
resultsHandlerCalled when the query finishes executing. If unsuccessful, error contains information about what went wrong, otherwise it will be set to nil.

◆ readStatisticsForQuantityType:predicate:options:resultsHandler:

- (void) readStatisticsForQuantityType: (HKQuantityType *) quantityType
predicate: (NSPredicate *) predicate
options: (HKStatisticsOptions) options
resultsHandler: (void(^)(id result, NSError *error)) resultsHandler 

A query that performs statistical calculations over a set of matching quantity samples, and returns the results. See HKStatisticsQuery.

Parameters
quantityTypethe type of sample to read.
predicatea predicate that limits the results of the query
optionsa single option that defines the type of calculation to be performed on the data
resultsHandlerCalled when the query finishes executing. If unsuccessful, error contains information about what went wrong, otherwise it will be set to nil.