I recently developed a QR code parsing module.
Google's open-source project Zxing
The Flash function added to Zxing is as follows:
In the CameraManager class under the com. xxx. xxx. Zxing. camera package
Add code:
// OpenLight enables the flashlight.
// OffLight is to turn off the flashlight
Public void openLight () {if (camera! = Null) {parameter = camera. getParameters (); parameter. setFlashMode (Parameters. FLASH_MODE_TORCH); camera. setParameters (parameter) ;}} public void offLight () {if (camera! = Null) {parameter = camera. getParameters (); parameter. setFlashMode (Parameters. FLASH_MODE_OFF); camera. setParameters (parameter );}}
In the class where you need to call the flashlight
// Turn on the flashlight CameraManager. get (). openLight (); // turn off the flashlight CameraManager. get (). offLight ();
The Flash function is added.
Hope to be useful to everyone