Android LED_NOTIFICATION_ID 无法解析为变量
我查找了有关如何让 Android 设备 LED 闪烁的示例,并且收到了有关无法将 LED_NOTIFICATION_ID 解析为变量的消息。我的代码如下。有谁可以告诉我为什么会收到此错误?
private void redFlashLight(Context context)
{
NotificationManager nm = ( NotificationManager ) context.getSystemService( context.NOTIFICATION_SERVICE );
Notification notif = new Notification();
notif.ledARGB = 0xFFff0000;
notif.flags = Notification.FLAG_SHOW_LIGHTS;
notif.ledOnMS = 100;
notif.ledOffMS = 100;
notif.flags = Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_ONLY_ALERT_ONCE;
nm.notify(LED_NOTIFICATION_ID, notif);
}
I've looked for examples on how to get the android device LED to blink and I've gotten the message about not being able to resolve LED_NOTIFICATION_ID to a variable. My code is below. Is there anyone that can tell me why I'm receiving this error?
private void redFlashLight(Context context)
{
NotificationManager nm = ( NotificationManager ) context.getSystemService( context.NOTIFICATION_SERVICE );
Notification notif = new Notification();
notif.ledARGB = 0xFFff0000;
notif.flags = Notification.FLAG_SHOW_LIGHTS;
notif.ledOnMS = 100;
notif.ledOffMS = 100;
notif.flags = Notification.FLAG_SHOW_LIGHTS | Notification.FLAG_ONLY_ALERT_ONCE;
nm.notify(LED_NOTIFICATION_ID, notif);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那时您还没有将
LED_NOTIFICATION_ID
声明为变量。查找拼写错误。它应该用类名来限定吗?You haven't declared
LED_NOTIFICATION_ID
as a variable then. Look for misspellings. Is it supposed to be qualified with a class name?