问题描述
我要控制LED在Android设备上比被通知类提供了更多的控制权。通知允许你改变闪烁的速度;例如300毫秒时,1000毫秒关,但仅此而已。
I want to control the LED on an Android device with more control than is offered by the Notification class. Notifications allow you to change the rate of flashing; e.g. 300 milliseconds on, 1000 milliseconds off, but that's it.
从本质上讲,我想开启和关闭LED随意在任意时间。有谁知道这是否可能?该API似乎并没有这么说。它依赖于特定的硬件?
Essentially, I would like to turn the LED on and off at will at arbitrary times. Does anyone know if this is possible? The API does not seem to say so. Does it depend on the specific hardware?
推荐答案
我还没有尝试过这在code,但SDK显示了这一点:
I haven't tried this in code, but the SDK shows this:
- 要关闭LED,为colorARGB为ledOnMS和ledOffMS alpha通道或0传递0。
- 要打开LED,通过1 ledOnMS和0 ledOffMS。
- 要闪烁的LED,通过毫秒,这应该是和ledOnMS和ledOffMS的关数。
然后你可以使用NotificationManager.cancel()擅自关闭通知功能。
And then you could use NotificationManager.cancel() to arbitrarily turn the notification off.
的
这篇关于能在Android手机LED在不使用Notification对象操纵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!