public class HKWorkoutBuilder extends NSObject
An HKWorkoutBuilder is used to incrementally create new workouts in the HealthKit database. Samples, events, and metadata may be added to a builder either during a live workout session or to create a workout that occurred in the past. Calling finishWorkoutWithCompletion: will create a new workout with samples, events, and metadata that have been provided.
| Modifier and Type | Class and Description |
|---|---|
static interface |
HKWorkoutBuilder.Block_addMetadataCompletion |
static interface |
HKWorkoutBuilder.Block_addSamplesCompletion |
static interface |
HKWorkoutBuilder.Block_addWorkoutEventsCompletion |
static interface |
HKWorkoutBuilder.Block_beginCollectionWithStartDateCompletion |
static interface |
HKWorkoutBuilder.Block_endCollectionWithEndDateCompletion |
static interface |
HKWorkoutBuilder.Block_finishWorkoutWithCompletion |
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
HKWorkoutBuilder(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
void |
addMetadataCompletion(NSDictionary<java.lang.String,?> metadata,
HKWorkoutBuilder.Block_addMetadataCompletion completion)
addMetadata:completion:
|
void |
addSamplesCompletion(NSArray<? extends HKSample> samples,
HKWorkoutBuilder.Block_addSamplesCompletion completion)
addSamples:completion:
|
void |
addWorkoutEventsCompletion(NSArray<? extends HKWorkoutEvent> workoutEvents,
HKWorkoutBuilder.Block_addWorkoutEventsCompletion completion)
addWorkoutEvents:completion:
|
static HKWorkoutBuilder |
alloc() |
static HKWorkoutBuilder |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
void |
beginCollectionWithStartDateCompletion(NSDate startDate,
HKWorkoutBuilder.Block_beginCollectionWithStartDateCompletion completion)
beginCollectionWithStartDate:error:
|
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
HKDevice |
device()
[@property] device
|
void |
discardWorkout()
discardWorkout
|
double |
elapsedTimeAtDate(NSDate date)
elapsedTimeAtDate:
|
void |
endCollectionWithEndDateCompletion(NSDate endDate,
HKWorkoutBuilder.Block_endCollectionWithEndDateCompletion completion)
endCollectionWithEndDate:error:
|
NSDate |
endDate()
[@property] endDate
|
void |
finishWorkoutWithCompletion(HKWorkoutBuilder.Block_finishWorkoutWithCompletion completion)
finishWorkoutWithCompletion:
|
static long |
hash_static() |
HKWorkoutBuilder |
init() |
HKWorkoutBuilder |
initWithHealthStoreConfigurationDevice(HKHealthStore healthStore,
HKWorkoutConfiguration configuration,
HKDevice device)
initWithHealthStore:configuration:device:
|
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
NSDictionary<java.lang.String,?> |
metadata()
[@property] metadata
|
static HKWorkoutBuilder |
new_objc() |
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
HKSeriesBuilder |
seriesBuilderForType(HKSeriesType seriesType)
seriesBuilderForType:
|
static void |
setVersion_static(long aVersion) |
NSDate |
startDate()
[@property] startDate
|
HKStatistics |
statisticsForType(HKQuantityType quantityType)
statisticsForType:
|
static org.moe.natj.objc.Class |
superclass_static() |
static long |
version_static() |
HKWorkoutConfiguration |
workoutConfiguration()
[@property] workoutConfiguration
|
NSArray<? extends HKWorkoutEvent> |
workoutEvents()
[@property] workoutEvents
|
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKeypublic static boolean accessInstanceVariablesDirectly()
public void addMetadataCompletion(NSDictionary<java.lang.String,?> metadata, HKWorkoutBuilder.Block_addMetadataCompletion completion)
Adds new metadata to the builder instance. This method can be called more than once; each time the newly provided metadata will be merged with previously added metadata in the same manner as -[NSMutableDictionary addEntriesFromDictionary:]. This operation is performed asynchronously and the completion will be executed on an arbitrary background queue.
metadata - The metadata to add to the workout.completion - Block to be called when the addition of metadata to the builder is complete. If success is
YES, the metadata has been added to the builder successfully. If success is NO, error will
be non-null and will contain the error encountered during the insertion operation. When an
error occurs, the builder's metadata property will remain unchanged.public void addSamplesCompletion(NSArray<? extends HKSample> samples, HKWorkoutBuilder.Block_addSamplesCompletion completion)
Adds new samples to the builder instance. This method can be called multiple times to add samples incrementally to the builder. The samples will be saved to the database if they have not already been saved. The constraints of -[HKHealthStore saveObject:withCompletion:] apply to this method as well. The start date of the samples must be later than the start date of the receiver. It is an error to call this method after finishWorkoutWithCompletion: has been called. This operation is performed asynchronously and the completion will be executed on an arbitrary background queue.
samples - The samples to add to the workout.completion - Block to be called when the insertion is complete. If success is YES, the samples were added
to the builder successfully. If success is NO, error will be non-nil and contain the error
encountered while adding the new samples.public void addWorkoutEventsCompletion(NSArray<? extends HKWorkoutEvent> workoutEvents, HKWorkoutBuilder.Block_addWorkoutEventsCompletion completion)
Adds new workout events to the builder instance. This method can be called many times to add workout events incrementally to the builder. It is an error to call this method after finishWorkoutWithCompletion: has been called. This operation is performed asynchronously and the completion will be executed on an arbitrary background queue.
workoutEvents - The events to add to the builder.completion - Block to be called when the addition of events to the builder is complete. If success is
YES, the events were added to the builder successfully. If success is NO, error will be
non-null and will contain the error encountered during the insertion operation.public static HKWorkoutBuilder alloc()
public static HKWorkoutBuilder allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public void beginCollectionWithStartDateCompletion(NSDate startDate, HKWorkoutBuilder.Block_beginCollectionWithStartDateCompletion completion)
Sets the workout start date and activates the workout builder.
Calling this method is required before any samples, events or metadata can be added to the builder.
startDate - The start date of the workout.completion - Called once data collection has started or has failed to start.public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public HKDevice device()
The HKDevice to be associated with the workout.
public void discardWorkout()
Finishes building the workout and discards the result instead of saving it. Samples that were added to the workout will not be deleted. Adding samples, events, and metadata to the receiver after discardWorkout has been called is an error.
public double elapsedTimeAtDate(NSDate date)
The elapsed duration of the workout evaluated at the specified date. The duration does not include periods when the workout was paused, which are the intervals between pause and resume events.
public void endCollectionWithEndDateCompletion(NSDate endDate, HKWorkoutBuilder.Block_endCollectionWithEndDateCompletion completion)
Sets the workout end date and deactivates the workout builer.
Calling this method is required before you finish a workout builder.
endDate - The end date of the workout.completion - Called once data collection has stopped or has failed to stop.public NSDate endDate()
The end date for the workout, as provided by endCollectionWithEndDate:completion:
public void finishWorkoutWithCompletion(HKWorkoutBuilder.Block_finishWorkoutWithCompletion completion)
Creates and saves an HKWorkout using samples and events that have been added to workout previously.
completion - Block to be called after the HKWorkout object has been created and saved. If the returned
workout is nil, an error may have occurred in which case error will be non-nil. If both
workout and error are nil then finishing the workout succeeded but the workout sample
is not available because the device is locked.public static long hash_static()
public HKWorkoutBuilder init()
public HKWorkoutBuilder initWithHealthStoreConfigurationDevice(HKHealthStore healthStore, HKWorkoutConfiguration configuration, HKDevice device)
The designated initializer to create an HKWorkoutBuilder.
Creates a new HKWorkoutBuilder unconnected to any HKWorkoutSession or any sources of data.
healthStore - Specifies the HKHealthStore object to use for building the workout. The store is retained
until the builder is finished and a workout has been saved or discarded.configuration - The workout configuration to be used.device - The HKDevice to attach to the resulting HKWorkout.public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public NSDictionary<java.lang.String,?> metadata()
The metadata that will be used when the workout is finished.
public static HKWorkoutBuilder new_objc()
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public HKSeriesBuilder seriesBuilderForType(HKSeriesType seriesType)
Retrieves the associated series builder for the specified type.
Retrieves, and creates if it does not already exist, the series builder for the specified type. The series constructed with the returned builder will be associated with the workout when it is finished.
seriesType - The series type for which the builder should be retrieved.public static void setVersion_static(long aVersion)
public NSDate startDate()
The start date for the workout, as provided by beginCollectionWithStartDate:completion:
public HKStatistics statisticsForType(HKQuantityType quantityType)
Returns an HKStatistics object containing the statistics for all the samples of the given type that have been added to the receiver. If there are no samples of the given type then nil is returned.
quantityType - The quantity type to gather statistics about.public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public HKWorkoutConfiguration workoutConfiguration()
The configuration for the workout being built.
public NSArray<? extends HKWorkoutEvent> workoutEvents()
Workout events that have been added to the builder.
New events that are added using addWorkoutEvents:completion: will be appended to this array once the completion is called.