Class WorkoutConfiguration
java.lang.Object
com.codename1.health.workout.WorkoutConfiguration
Describes a workout about to be started.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAsks the platform to collect this type automatically during the workout.The configured activity.The types requested for automatic collection.The configured location type.getTitle()The configured title, or null.booleantruewhen background recording was requested.setActivityType(WorkoutActivityType activityType) The kind of exercise.setKeepAliveInBackground(boolean keepAliveInBackground) Asks the operating system to keep the app running while the workout records.setLocationType(WorkoutLocationType locationType) Indoors or outdoors -- seeWorkoutLocationType, which affects whether GPS is used.A user-visible title for the workout.
-
Constructor Details
-
WorkoutConfiguration
public WorkoutConfiguration()
-
-
Method Details
-
setActivityType
The kind of exercise. Defaults toWorkoutActivityType.OTHER. -
getActivityType
The configured activity. -
setLocationType
Indoors or outdoors -- seeWorkoutLocationType, which affects whether GPS is used. -
getLocationType
The configured location type. -
setKeepAliveInBackground
Asks the operating system to keep the app running while the workout records.
On watchOS and iOS 26 the workout session itself holds the process alive and this needs nothing further. On Android it requires a foreground service, so the app must set the
android.health.foregroundServicebuild hint -- without it, starting such a session fails configuration validation rather than being silently killed mid-run. -
isKeepAliveInBackground
public boolean isKeepAliveInBackground()truewhen background recording was requested. -
addCollectedType
Asks the platform to collect this type automatically during the workout. Honoured only whereWorkoutManager.isSensorCollectionSupported()istrue; elsewhere you must feed samples in yourself withWorkoutSession.addSamples(java.util.List). -
getCollectedTypes
The types requested for automatic collection. -
setTitle
A user-visible title for the workout. -
getTitle
The configured title, or null.
-