Is the flashlight intensity/brightness controllable on Android?

Sebastian Engel picture Sebastian Engel · Dec 20, 2013 · Viewed 7.3k times · Source

I am porting an existing iOS app to Android. In a special use case, the (iOS) app uses the flashlight to indicate different states of a progress to the user (as the screen must be facing down). It is switched on just for approx. 3 seconds for two times. To make clear the progress even more / make it easier to differ, we want the intensity/brightness of the flashlight to be lower / higher between the states. The iOS app does that, but there seems to be no official or reliable way to control the intensity of the flashlight on Android. I read about a hacky way to set the brightness value by writing to "sys/class/leds/flashlight/brightness" or alternatively "/sys/devices/platform/flashlight.0/leds/flashlight/brightness". As my Galaxy S4 does not have these files (and so probably many other devices), this solution also doesn't solve my problem. Anyone solved that kind of problem or has a hint?

Thanks.

UPDATE: I'm looking for a reliable solution that works on unrooted devices.

Answer