可以在不使用通知对象的情况下操作 Android 手机 LED 吗?
我想通过比通知类提供更多的控制来控制 Android 设备上的 LED。 通知允许您更改闪烁速率; 例如,打开 300 毫秒,关闭 1000 毫秒,仅此而已。
本质上,我想在任意时间随意打开和关闭 LED。 有谁知道这是否可能? API好像没这么说。 这取决于具体的硬件吗?
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.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还没有在代码中尝试过这一点,但 SDK 显示了这一点:
然后你可以使用NotificationManager.cancel()任意关闭通知。
http://developer.android.com/reference/android/app/ notification.html#FLAG_SHOW_LIGHTS
I haven't tried this in code, but the SDK shows this:
And then you could use NotificationManager.cancel() to arbitrarily turn the notification off.
http://developer.android.com/reference/android/app/Notification.html#FLAG_SHOW_LIGHTS
您应该能够通过通知来执行此操作。 您可以使用通知管理器来升起和取消 LED,并且可以使用 Android 的警报管理器部分来控制任意时间。
You should be able to do this with a notification. You can raise and cancel the led using the notification manager and you could use the alarm manager part of android to control the arbitary times.