Android LED_NOTIFICATION_ID cannot be resolved to a variable
-
21-03-2021 - |
Question
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);
}
Solution
You haven't declared LED_NOTIFICATION_ID
as a variable then. Look for misspellings. Is it supposed to be qualified with a class name?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow