Question

The use of front light option with zxing1.6 barcode scanner does not work on my Nexus One. I need to be able to use the flashlight in my app, but you can't have two instances of the camera running. Is there a way to use the flashlight without accessing the camera? Or can I somehow access a camera that is already in use?

I am using the Google IntentIntegrator.java patch to be able to scan barcodes.

Was it helpful?

Solution

The short answer is "no"; the front LED is controlled as a flash mode, which is a property of the camera. It is mode "torch". And no two apps can't open the camera at the same time.

(A longer answer is that there used to be a hidden API for this, which is what Barcode Scanner tries to access, but it doesn't work on almost any device anymore. You can dig into the source code to see FlashlightManager.)

Since Android 2.x there is this proper API for turning on the light, and the beta of the next version of Barcode Scanner does use it. You can try it here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top