BEHealthKit 1.11
A HealthKit plugin for Unity
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BeliefEngine.HealthKit.HealthStore Class Reference

Primary interface for HealthKit.

Public Member Functions

void ReadHealthDocuments (Predicate predicate, int limit, bool includeData, ReceivedHealthData< List< DocumentSample >, Error > handler)
 Read health documents.
 
void ReadClinicalRecord (HKClinicalType dataType, ReceivedHealthData< List< ClinicalRecord >, Error > handler)
 Read clinical records.
 
void Awake ()
 Does basic setup for the plugin.
 
bool IsHealthDataAvailable ()
 returns true if HealthKit is available on this device.
 
HKAuthorizationStatus AuthorizationStatusForType (HKDataType dataType)
 returns authorization status for a given datatype.
 
void Authorize (HealthKitDataTypes types, AuthorizationHandler handler)
 requests authorization to read the supplied data types, with a completion handler.
 
void Authorize (HealthKitDataTypes types)
 requests authorization to read the supplied data types.
 
void GenerateDummyData (HealthKitDataTypes types)
 Generates dummy data for the supplied data types. Mostly for testing in the Simulator.
 
void ReadCombinedQuantitySamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< double, Error > handler)
 Read quantity samples & return the sum.
 
void ReadQuantitySamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< QuantitySample >, Error > handler)
 Read quantity samples & return a list of QuantitySamples.
 
void WriteQuantitySample (HKDataType dataType, Quantity quantity, DateTimeOffset startDate, DateTimeOffset endDate, WroteSample handler)
 Write a quantity sample.
 
void ReadCategorySamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< CategorySample >, Error > handler)
 Read category samples & return a list of CategorySamples.
 
void WriteCategorySample (HKDataType dataType, int value, DateTimeOffset startDate, DateTimeOffset endDate, WroteSample handler)
 Write a category sample.
 
void ReadCharacteristic (HKDataType dataType, ReceivedHealthData< Characteristic, Error > handler)
 Read a characteristic.
 
void ReadCorrelationSamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< CorrelationSample >, Error > handler)
 Read correlation samples & return a list of CorrelationSamples.
 
void ReadWorkoutSamples (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< WorkoutSample >, Error > handler)
 Read workout samples & return a list of WorkoutSamples.
 
void WriteWorkoutSample (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, WroteSample handler)
 Write a workout sample.
 
void WriteWorkoutSample (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, Quantity calories, Quantity distance, WroteSample handler)
 Write a workout sample.
 
void BuildWorkout (WorkoutBuilder builder, WroteSample handler)
 Write a workout session using a WorkoutBuilder.
 
void AddObserverQuery (HKDataType dataType, ReceivedHealthData< List< Sample >, Error > handler)
 Start an Observer Query.
 
void StopObserverQuery (HKDataType dataType)
 Stops an Observer Query.
 
void AddObserverQueryHandler (HKDataType dataType, ReceivedHealthData< List< Sample >, Error > handler)
 Registers a callback for an observer query.
 
void BeginReadingPedometerData (DateTimeOffset startDate, ReceivedHealthData< List< PedometerData >, Error > handler)
 start reading from the pedometer.
 
void StopReadingPedometerData ()
 stop reading from the pedometer.
 
void ReadCombinedQuantityStatistics (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< HealthStatistics, Error > handler)
 Perform a statistics query with the cumulative sum statistics option.
 
void ReadStatistics (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, StatisticsOptions options, ReceivedHealthData< HealthStatistics, Error > handler)
 Perform a statistics query.
 
void ReadStatisticsCollection (HKDataType dataType, Predicate predicate, StatisticsOptions options, DateTimeOffset anchorDate, TimeSpan interval, ReceivedHealthData< HealthStatisticsCollection, Error > handler)
 Perform a statistics collection query.
 
void ReadSteps (DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< double, Error > handler)
 a convenience method to read HKQuantityTypeIdentifierStepCount quantity samples
 
void EnableBackgroundDelivery (HKDataType dataType, HKUpdateFrequency frequency)
 enable background delivery for a datatype. This isn't very useful, TBH...
 

Member Function Documentation

◆ AddObserverQuery()

void BeliefEngine.HealthKit.HealthStore.AddObserverQuery ( HKDataType dataType,
ReceivedHealthData< List< Sample >, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
handlerCalled each time the observer query fires.

◆ AddObserverQueryHandler()

void BeliefEngine.HealthKit.HealthStore.AddObserverQueryHandler ( HKDataType dataType,
ReceivedHealthData< List< Sample >, Error > handler )
inline
Parameters
dataTypeThe datatype of the query.
handlerCalled each time the observer query fires.

◆ AuthorizationStatusForType()

HKAuthorizationStatus BeliefEngine.HealthKit.HealthStore.AuthorizationStatusForType ( HKDataType dataType)
inline

See HKAuthorizationStatus in the Apple documentation. More useful for write permission; will not tell you if the user denies permission to read the data; it will merely appear as if there is no data.

Parameters
dataTypethe HealthKit datatype to query

◆ BeginReadingPedometerData()

void BeliefEngine.HealthKit.HealthStore.BeginReadingPedometerData ( DateTimeOffset startDate,
ReceivedHealthData< List< PedometerData >, Error > handler )
inline

Start reading from the pedometer & register a delegate to parse the samples.

Parameters
startDateThe date to start reading samples from.
handlerCalled when a sample is received.

◆ BuildWorkout()

void BeliefEngine.HealthKit.HealthStore.BuildWorkout ( WorkoutBuilder builder,
WroteSample handler )
inline
Parameters
buildera WorkoutBuilder object.
handlerCalled when the function finishes executing.

◆ ReadCategorySamples()

void BeliefEngine.HealthKit.HealthStore.ReadCategorySamples ( HKDataType dataType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< List< CategorySample >, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
handlerCalled when the function finishes executing.

◆ ReadCharacteristic()

void BeliefEngine.HealthKit.HealthStore.ReadCharacteristic ( HKDataType dataType,
ReceivedHealthData< Characteristic, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
handlerCalled when the function finishes executing.

◆ ReadClinicalRecord()

void BeliefEngine.HealthKit.HealthStore.ReadClinicalRecord ( HKClinicalType dataType,
ReceivedHealthData< List< ClinicalRecord >, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
handlerCalled when the function finishes executing.

◆ ReadCombinedQuantitySamples()

void BeliefEngine.HealthKit.HealthStore.ReadCombinedQuantitySamples ( HKDataType dataType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< double, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
handlerCalled when the function finishes executing.

◆ ReadCombinedQuantityStatistics()

void BeliefEngine.HealthKit.HealthStore.ReadCombinedQuantityStatistics ( HKDataType dataType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< HealthStatistics, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
handlerCalled when the function finishes executing.

◆ ReadCorrelationSamples()

void BeliefEngine.HealthKit.HealthStore.ReadCorrelationSamples ( HKDataType dataType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< List< CorrelationSample >, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
handlerCalled when the function finishes executing.

◆ ReadHealthDocuments()

void BeliefEngine.HealthKit.HealthStore.ReadHealthDocuments ( Predicate predicate,
int limit,
bool includeData,
ReceivedHealthData< List< DocumentSample >, Error > handler )
inline
Parameters
predicateThe predicate used to filter the results.
limitThe maximum number of docments to return.
includeDataSend true to include all document data. send false to just return a summary.
handlerCalled when the function finishes executing.

◆ ReadQuantitySamples()

void BeliefEngine.HealthKit.HealthStore.ReadQuantitySamples ( HKDataType dataType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< List< QuantitySample >, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
handlerCalled when the function finishes executing.

◆ ReadStatistics()

void BeliefEngine.HealthKit.HealthStore.ReadStatistics ( HKDataType dataType,
DateTimeOffset startDate,
DateTimeOffset endDate,
StatisticsOptions options,
ReceivedHealthData< HealthStatistics, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
optionsthe statistics options.
handlerCalled when the function finishes executing.

◆ ReadStatisticsCollection()

void BeliefEngine.HealthKit.HealthStore.ReadStatisticsCollection ( HKDataType dataType,
Predicate predicate,
StatisticsOptions options,
DateTimeOffset anchorDate,
TimeSpan interval,
ReceivedHealthData< HealthStatisticsCollection, Error > handler )
inline
Parameters
dataTypeThe datatype to read.
predicateThe predicate used to filter the results.
optionsAn option that defines the type of statistical calculations performed or the way in which data from multiple sources are merged.
anchorDateThe date used to anchor the collection’s time intervals.
intervalThe date components that define the time interval for each statistics object in the collection.
handlerCalled when the function finishes executing.

◆ ReadWorkoutSamples()

void BeliefEngine.HealthKit.HealthStore.ReadWorkoutSamples ( WorkoutActivityType activityType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< List< WorkoutSample >, Error > handler )
inline
Parameters
activityTypeThe activity type to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
handlerCalled when the function finishes executing.

◆ StopObserverQuery()

void BeliefEngine.HealthKit.HealthStore.StopObserverQuery ( HKDataType dataType)
inline
Parameters
dataTypeThe datatype of the query to stop.

◆ WriteCategorySample()

void BeliefEngine.HealthKit.HealthStore.WriteCategorySample ( HKDataType dataType,
int value,
DateTimeOffset startDate,
DateTimeOffset endDate,
WroteSample handler )
inline
Parameters
dataTypeThe datatype to write.
valuethe (integer) value to use to create a sample.
startDateThe starting date of the sample to write.
endDateThe ending date of the sample to write.
handlerCalled when the function finishes executing.

◆ WriteQuantitySample()

void BeliefEngine.HealthKit.HealthStore.WriteQuantitySample ( HKDataType dataType,
Quantity quantity,
DateTimeOffset startDate,
DateTimeOffset endDate,
WroteSample handler )
inline
Parameters
dataTypeThe datatype to write.
quantitythe quantity to use to create a sample.
startDateThe starting date of the sample to write.
endDateThe ending date of the sample to write.
handlerCalled when the function finishes executing.

◆ WriteWorkoutSample() [1/2]

void BeliefEngine.HealthKit.HealthStore.WriteWorkoutSample ( WorkoutActivityType activityType,
DateTimeOffset startDate,
DateTimeOffset endDate,
Quantity calories,
Quantity distance,
WroteSample handler )
inline
Parameters
activityTypeThe workout activity type to write.
startDateThe starting date of the sample to write.
endDateThe ending date of the sample to write.
caloriesThe kilocalories burned during the activity
distanceThe distance traveled during the activity (for e.g. running)
handlerCalled when the function finishes executing.

◆ WriteWorkoutSample() [2/2]

void BeliefEngine.HealthKit.HealthStore.WriteWorkoutSample ( WorkoutActivityType activityType,
DateTimeOffset startDate,
DateTimeOffset endDate,
WroteSample handler )
inline
Parameters
activityTypeThe workout activity type to write.
startDateThe starting date of the sample to write.
endDateThe ending date of the sample to write.
handlerCalled when the function finishes executing.