Is the flashlight intensity/brightness controllable on Android?

梦想的初衷 提交于 2019-12-11 04:28:45

问题


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.

来源:https://stackoverflow.com/questions/20701937/is-the-flashlight-intensity-brightness-controllable-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!