我可以更改 Android 设备的 LED 强度吗? [英] Can I change the LED intensity of an Android device?

查看:17
本文介绍了我可以更改 Android 设备的 LED 强度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法设置我想要的 LED 强度?我知道要打开我使用的 LED:

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);

但是这段代码只是打开了 LED.但是有没有办法为 LED 设置不同的强度以获得更强的光或降低光强度?

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?

推荐答案

HTC 有一个替代 API 支持这个,但是它只在 HTC Sense 设备上,并且从 Gingerbread 开始,他们已经改变了权限,所以它只适用于他们的 Flashlight应用程序,而不是第三方应用程序(除非您使用 root).

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).

但在 2.2 HTC 设备上,您可以通过将字符串写入 /sys/devices/platform/flashlight.0/leds/flashlight/brightness 来使用它.这控制 LED 是否打开以及它的亮度.最大亮度写"128 ",半亮度写"64 ".易于从 adb shell 进行测试:

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 ", half brightness write "64 ". Easy to test from adb shell:

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

最后通过在此处写入 "0 " 将其关闭.

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

这篇关于我可以更改 Android 设备的 LED 强度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆