Added in API level 30

BooleanAction


class BooleanAction : ControlAction
kotlin.Any
   ↳ android.service.controls.actions.ControlAction
   ↳ android.service.controls.actions.BooleanAction

Action sent by user toggling a Control between checked/unchecked. This action is available when the Control was constructed with either a ToggleTemplate or a ToggleRangeTemplate.

Summary

Inherited constants
Public constructors
BooleanAction(templateId: String, newState: Boolean)

BooleanAction(templateId: String, newState: Boolean, challengeValue: String?)

Public methods
Int

Boolean

The new state set for the button in the corresponding ToggleTemplate.

Inherited functions

Public constructors

BooleanAction

Added in API level 30
BooleanAction(
    templateId: String,
    newState: Boolean)
Parameters
templateId String: the identifier of the ToggleTemplate that produced this action. This value cannot be null.
newState Boolean: new value for the state displayed by the ToggleTemplate.

BooleanAction

Added in API level 30
BooleanAction(
    templateId: String,
    newState: Boolean,
    challengeValue: String?)
Parameters
templateId String: the identifier of the template that originated this action. This value cannot be null.
newState Boolean: new value for the state displayed by the template.
challengeValue String?: a value sent by the user along with the action to authenticate. null is sent when no authentication is needed or has not been requested.

Public methods

getActionType

Added in API level 30
fun getActionType(): Int
Return
Int ControlAction#TYPE_BOOLEAN

getNewState

Added in API level 30
fun getNewState(): Boolean

The new state set for the button in the corresponding ToggleTemplate.

Return
Boolean true if the button was toggled from unchecked to checked.