Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the LED intensity of an Android device?

Is there a way to set the LED intensity that I desire? I know that to turn on the LED I use:

     p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);      mycam.setParameters(p); 

But this code just turns on the LED. But is there a way to set different intensities to the LED for a stronger light or to reduce the light intensity?

like image 834
Buda Gavril Avatar asked May 11 '11 20:05

Buda Gavril


People also ask

How do I change the flashlight intensity on my Android?

Tap and hold the Flashlight icon until you see the slider appear. 3. Swipe up or down to control the brightness of the flashlight.

How do I increase my flashlight?

Open the Settings app, then go to System → Gestures → Quick Tap. Turn on the feature by pressing the Use Quick Tap button. Scroll down, then tap the Toggle flashlight option. Double-tap the back of your phone to make sure you see the Quick Tap detected notification.


2 Answers

HTC has an alternative API that supports this, however it's only on HTC Sense devices, and as of Gingerbread they've changed the permissions so it's only for their Flashlight app, not third party ones (unless you use root).

But on 2.2 HTC devices you can use it by writing a string to /sys/devices/platform/flashlight.0/leds/flashlight/brightness. This controls if the LED is on and how bright it is. For maximum brightness write "128\n", half brightness write "64\n". Easy to test from adb shell:

echo "128" > /sys/devices/platform/flashlight.0/leds/flashlight/brightness 

And finally turn it off by writing "0\n" there.

like image 184
Kevin TeslaCoil Avatar answered Oct 03 '22 05:10

Kevin TeslaCoil


Short answer is: NO.
Longer answer - maybe on some devices using undocumenterd calls / parameters. Supported flash modes, and their meanings (and behaviours) differ from device to device.

Your best option is to query supported flash modes, and hope they work as intented.

like image 39
Konstantin Pribluda Avatar answered Oct 03 '22 04:10

Konstantin Pribluda