Can I change the LED intensity of an Android device?
Solution 1
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.
Solution 2
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.
Solution 3
Try to set different Flash Modes available for Camera parameters.
* FLASH_MODE_OFF
* FLASH_MODE_AUTO
* FLASH_MODE_ON
* FLASH_MODE_RED_EYE
* FLASH_MODE_TORCH
you can set Flash mode using setFlashMode() method.
This was just for camera back light. but if you want to change complete screen intensity. have a look at the example here.
Solution 4
Try to find the code of this function:
private native final void native_setParameters(String params);
I beleive that you will find out if this is possible when you look through it.
Looking at the public
s, it seems impossible
Solution 5
I have tried this in my Samsung Galaxy S3 Mini. I have not tried on other devices.
Whenever i do this (while the led is ON):
public void changeIntensity()
{
cam.stopPreview();
cam.startPreview();
}
The LED rotates between 3 levels of intensity. It makes no sense, but it works.
![Buda Gavril](https://i.stack.imgur.com/ODH9r.jpg?s=256&g=1)
Buda Gavril
Updated on September 28, 2020Comments
-
Buda Gavril over 3 years
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?
-
Kartik Domadiya almost 13 yearsThanks @Kevin TeslaCoil.. I got what you told. But dont know how to implement it. Can you show a guide or tutorial related to this ?
-
Kartik Domadiya almost 13 yearsSo far i got code.google.com/p/quick-settings/source/browse/trunk/… .....
-
Kevin TeslaCoil almost 13 yearsQuick Settings, cool. I think you're just missing the \n part. Here's what I'm using for TeslaLED teslacoilsw.com/tmp/SysDevicesLED.java
-
Kartik Domadiya over 12 yearsneed your help again. The way you gave here for changing the intensity of flash light doesnt work on GingerBread. And again one more weired problem is there. I have two modes viz light and bright.. when i select light and then bright e.thing works fine. But when i select bright first and then light, intensity of light is not getting changed...
-
Pierre Barbera over 11 yearsis there an overview shomewhere of things that can be changed by writing to the sysfs?
-
VAdaihiep almost 11 yearsThanks for your answer. But I use TinyFlashLight (play.google.com/store/apps/details?id=com.devuni.flashlight) in my HTC phone, it can adjust brightness flashlight without root. So could you tell me how to do it?
-
nkint about 10 yearsThis post was written 3 years ago. is there some update?