BEHealthKit 1.18
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 > callback)
 Read quantity samples & return the sum.
 
void ReadQuantitySamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< QuantitySample >, Error > callback)
 Read quantity samples & return a list of QuantitySamples.
 
void WriteQuantitySample (HKDataType dataType, Quantity quantity, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< bool, Error > callback)
 Write a quantity sample.
 
void ReadCategorySamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< CategorySample >, Error > callback)
 Read category samples & return a list of CategorySamples.
 
void WriteCategorySample (HKDataType dataType, int value, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< bool, Error > callback)
 Write a category sample.
 
void ReadCharacteristic (HKDataType dataType, ReceivedHealthData< Characteristic, Error > callback)
 Read a characteristic.
 
void ReadCorrelationSamples (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< CorrelationSample >, Error > callback)
 Read correlation samples & return a list of CorrelationSamples.
 
void ReadWorkoutSamples (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< WorkoutSample >, Error > callback)
 Read workout samples & return a list of WorkoutSamples.
 
void ReadWorkoutRouteSamples (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< WorkoutSample >, Error > callback)
 Read workout routes from workout samples & return a list of WorkoutRoutes.
 
void WriteWorkoutSample (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< bool, Error > callback)
 Write a workout sample.
 
void WriteWorkoutSample (WorkoutActivityType activityType, DateTimeOffset startDate, DateTimeOffset endDate, Quantity calories, Quantity distance, ReceivedHealthData< bool, Error > callback)
 Write a workout sample.
 
void BuildWorkout (WorkoutBuilder builder, ReceivedHealthData< bool, Error > callback)
 Write a workout session using a WorkoutBuilder.
 
void ReadStateOfMindSamples (DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< List< StateOfMind >, Error > callback)
 Read state of mind & return a list of StateOfMindSamples.
 
void AddObserverQuery (HKDataType dataType, ReceivedHealthData< List< Sample >, Error > callback)
 Start an Observer Query.
 
void StopObserverQuery (HKDataType dataType)
 Stops an Observer Query.
 
void AddObserverQueryHandler (HKDataType dataType, ReceivedHealthData< List< Sample >, Error > callback)
 Registers a callback for an observer query.
 
void BeginReadingPedometerData (DateTimeOffset startDate, ReceivedHealthData< List< PedometerData >, Error > callback)
 start reading from the pedometer.
 
void StopReadingPedometerData ()
 stop reading from the pedometer.
 
void ReadCombinedQuantityStatistics (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< HealthStatistics, Error > callback)
 Perform a statistics query with the cumulative sum statistics option.
 
void ReadStatistics (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, StatisticsOptions options, ReceivedHealthData< HealthStatistics, Error > callback)
 Perform a statistics query.
 
void ReadStatistics (HKDataType dataType, DateTimeOffset startDate, DateTimeOffset endDate, Predicate predicate, StatisticsOptions options, ReceivedHealthData< HealthStatistics, Error > callback)
 Perform a statistics query.
 
void ReadStatisticsCollection (HKDataType dataType, Predicate predicate, StatisticsOptions options, DateTimeOffset anchorDate, TimeSpan interval, ReceivedHealthData< HealthStatisticsCollection, Error > callback)
 Perform a statistics collection query.
 
void ReadStatisticsCollection (HKDataType dataType, Predicate predicate, StatisticsOptions options, DateTimeOffset startDate, DateTimeOffset endDate, TimeSpan interval, ReceivedHealthData< HealthStatisticsCollection, Error > callback)
 Perform a statistics collection query.
 
void ReadSteps (DateTimeOffset startDate, DateTimeOffset endDate, ReceivedHealthData< double, Error > callback)
 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 > callback )
inline
Parameters
dataTypeThe datatype to read.
callbackCalled each time the observer query fires.

◆ AddObserverQueryHandler()

void BeliefEngine.HealthKit.HealthStore.AddObserverQueryHandler ( HKDataType dataType,
ReceivedHealthData< List< Sample >, Error > callback )
inline
Parameters
dataTypeThe datatype of the query.
callbackCalled 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 > callback )
inline

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

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

◆ BuildWorkout()

void BeliefEngine.HealthKit.HealthStore.BuildWorkout ( WorkoutBuilder builder,
ReceivedHealthData< bool, Error > callback )
inline
Parameters
buildera WorkoutBuilder object.
callbackCalled when the function finishes executing.

◆ ReadCategorySamples()

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

◆ ReadCharacteristic()

void BeliefEngine.HealthKit.HealthStore.ReadCharacteristic ( HKDataType dataType,
ReceivedHealthData< Characteristic, Error > callback )
inline
Parameters
dataTypeThe datatype to read.
callbackCalled 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 > callback )
inline
Parameters
dataTypeThe datatype to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
callbackCalled when the function finishes executing.

◆ ReadCombinedQuantityStatistics()

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

◆ ReadCorrelationSamples()

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

◆ ReadStateOfMindSamples()

void BeliefEngine.HealthKit.HealthStore.ReadStateOfMindSamples ( DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< List< StateOfMind >, Error > callback )
inline
Parameters
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
callbackCalled when the function finishes executing.

◆ ReadStatistics() [1/2]

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

◆ ReadStatistics() [2/2]

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

◆ ReadStatisticsCollection() [1/2]

void BeliefEngine.HealthKit.HealthStore.ReadStatisticsCollection ( HKDataType dataType,
Predicate predicate,
StatisticsOptions options,
DateTimeOffset anchorDate,
TimeSpan interval,
ReceivedHealthData< HealthStatisticsCollection, Error > callback )
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.
callbackCalled when the function finishes executing.

◆ ReadStatisticsCollection() [2/2]

void BeliefEngine.HealthKit.HealthStore.ReadStatisticsCollection ( HKDataType dataType,
Predicate predicate,
StatisticsOptions options,
DateTimeOffset startDate,
DateTimeOffset endDate,
TimeSpan interval,
ReceivedHealthData< HealthStatisticsCollection, Error > callback )
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.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
intervalThe date components that define the time interval for each statistics object in the collection.
callbackCalled when the function finishes executing.

◆ ReadWorkoutRouteSamples()

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

◆ ReadWorkoutSamples()

void BeliefEngine.HealthKit.HealthStore.ReadWorkoutSamples ( WorkoutActivityType activityType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< List< WorkoutSample >, Error > callback )
inline
Parameters
activityTypeThe activity type to read.
startDateThe date to start reading samples from.
endDateThe end date to limit samples to.
callbackCalled 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,
ReceivedHealthData< bool, Error > callback )
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.
callbackCalled when the function finishes executing.

◆ WriteQuantitySample()

void BeliefEngine.HealthKit.HealthStore.WriteQuantitySample ( HKDataType dataType,
Quantity quantity,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< bool, Error > callback )
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.
callbackCalled when the function finishes executing.

◆ WriteWorkoutSample() [1/2]

void BeliefEngine.HealthKit.HealthStore.WriteWorkoutSample ( WorkoutActivityType activityType,
DateTimeOffset startDate,
DateTimeOffset endDate,
Quantity calories,
Quantity distance,
ReceivedHealthData< bool, Error > callback )
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)
callbackCalled when the function finishes executing.

◆ WriteWorkoutSample() [2/2]

void BeliefEngine.HealthKit.HealthStore.WriteWorkoutSample ( WorkoutActivityType activityType,
DateTimeOffset startDate,
DateTimeOffset endDate,
ReceivedHealthData< bool, Error > callback )
inline
Parameters
activityTypeThe workout activity type to write.
startDateThe starting date of the sample to write.
endDateThe ending date of the sample to write.
callbackCalled when the function finishes executing.