Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created September 13, 2020 11:19
Show Gist options
  • Save magdamiu/07698dfb30bd22993d2c2921608c65b2 to your computer and use it in GitHub Desktop.
Save magdamiu/07698dfb30bd22993d2c2921608c65b2 to your computer and use it in GitHub Desktop.
Smile, it’s CameraX! [analysis and extensions] | Analysis - enable/disable the torch
val cameraControl = camera.cameraControl
val cameraInfo = camera.cameraInfo
cameraInfo.torchState.observe(this, Observer { state ->
if (state == TorchState.ON) {
// state on
} else {
// state off
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment