public final class WorkoutConfiguration
- Object
- WorkoutConfiguration
Constructors
public WorkoutConfiguration() |
Methods
Inherited methods
Constructor details
WorkoutConfiguration
public WorkoutConfiguration()Method details
setActivityType
public WorkoutConfiguration setActivityType(WorkoutActivityType activityType)WorkoutActivityType.OTHER.getActivityType
public WorkoutActivityType getActivityType()setLocationType
public WorkoutConfiguration setLocationType(WorkoutLocationType locationType)WorkoutLocationType, which affects
whether GPS is used.getLocationType
public WorkoutLocationType getLocationType()setKeepAliveInBackground
public WorkoutConfiguration setKeepAliveInBackground(boolean keepAliveInBackground)Asks the operating system to keep the app running while the workout
records. Not available in this release – passing true
throws.
Nothing honours it anywhere yet. Keeping the process alive needs
either a live HKWorkoutSession, which
WorkoutManager.isLiveSessionSupported() reports false for on
every platform here, or an Android foreground service, which the
build does not emit and for which no build hint exists. A setter
that stored the request and let the workout be killed mid-run
would be worse than one that refuses it: the app could not tell
the difference until a user lost a workout.
Until then, record with the app in the foreground, and write what you have collected rather than assuming the session will still be running when the user comes back.
Throws
IllegalArgumentException- if
keepAliveInBackgroundistrue.
isKeepAliveInBackground
public boolean isKeepAliveInBackground()false in this release – see
setKeepAliveInBackground(boolean).addCollectedType
public WorkoutConfiguration addCollectedType(HealthDataType type)WorkoutManager.isSensorCollectionSupported() is true; elsewhere
you must feed samples in yourself with
WorkoutSession.addSamples(java.util.List).getCollectedTypes
public List<HealthDataType> getCollectedTypes()setTitle
public WorkoutConfiguration setTitle(String title)getTitle
public String getTitle()