Can I control the flashlight without using android.hardware.Camera?

Using the front lighting option with a barcode scanner zxing1.6does not work on my Nexus One. I need to be able to use a flashlight in my application, but you cannot have two instances of the camera. Is there a way to use the flashlight without access to the camera? Or can I somehow access an already used camera?

I use Google patch IntentIntegrator.javato be able to crawl barcodes.

+5
source share
1 answer

The short answer is no; The front LED is controlled as a flash mode, which is a property of the camera. This is the torch mode. And no application can open the camera at the same time.

(The longer answer is that there was a hidden API for this that the barcode scanner is trying to access, but it hardly works on almost any device. You can paste the source code to see it FlashlightManager.)

Since Android 2.x has a corresponding API for turning on the light, the beta version of the next version of the barcode scanner really uses it. You can try it here .

+4
source

All Articles