Bixby Developer Center

Guides
References

unlock

optional

Pauses execution if device is locked and informs users they need to unlock their device to continue.

You can allow certain actions to be inaccessible while the device is locked and inform the user to unlock their phone by using this unlock key. To check if the phone is locked, you can use the $screenLocked expression in your actions or the $vivContext.screenLocked expression in your JavaScript implementation.

Note

In order to execute any actions while the phone is in the locked state, the proper permissions need to be set in the capsule.bxb file.

Examples

Using action validation:

  collect {
input (input) {
type (InputStruct)
min (Required) max (One)
validate {
if($screenLocked) {
unlock {
dialog("Unlock your phone!") // Optional, if not specified a default dialog is shown.
}
}
}
}
}

Catching the error at the output level:

  output (Output) {
throws {
error (LockedState) {
on-catch {
unlock {
dialog("Unlock your phone!") // Optional, if not specified a default dialog is shown.
}
}
}
}
}

Child Keys

dialog
optional
Dialog used to inform the user that the device needs to be unlocked