2

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.

Sebastian Engel
  • 3,500
  • 32
  • 30
  • Some flashlight apps in the Play store allow my phone(Nexus 4) to switch from low flashlight brightness to high, so it should be possible. – Max Dec 20 '13 at 10:53
  • Some search before posting always helps: http://stackoverflow.com/questions/5970188/can-i-change-the-led-intensity-of-an-android-device – Lefteris Dec 20 '13 at 11:03
  • Dear Lefteris, of course I was checking the web myself before asking. I also found this link. But the "solution" on it works only for HTC devices. As there is no official API in the SDK to do that thing, I guess there is no reliable solution for it. – Sebastian Engel Dec 20 '13 at 11:11
  • @MaxMommersteeg Do you mean e.g. Adjustable Torch? Yeah it works, but it requires the device to be rooted and again, I am not sure if its [solution](https://github.com/MohammadAG/android-AdjustableTorch/blob/master/src/com/mohammadag/adjustabletorch/Constants.java) is reliable on many if not all devices. – Sebastian Engel Dec 20 '13 at 11:14
  • Sebastian I don't know but this might help you: https://github.com/wuman/Flashlight-Controller – Lefteris Dec 20 '13 at 11:18
  • Thanks @Lefteris. Also found that. They are writing to /sys/class/leds/flashlight/brightness. Unfortunately this file does not exist on the Galaxy S4 and probably many others too. So also unreliable and root needed. :( – Sebastian Engel Dec 20 '13 at 11:23
  • Is there a solution for nexus? When recording a video the flash is getting hot after some time, when using the torch function from carmar.params. its not getting hot. A heartrate measure-app is using a brightness adjustment of the led too so any more ideas? – user1651460 Jan 20 '14 at 19:46

0 Answers0