public void setTorch(boolean on) {
        torchOn = on;
        if (cameraInstance != null) {
            cameraInstance.setTorch(on);
        }
    }
Call this on the main thread, while the preview is running.

@param on true to turn on the torch
zxing-android-embedded/src/com/journeyapps/barcodescanner/CameraPreview.java