I'm trying to use the LED on my notification and it's not working, i have this code:
NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(getApplicationContext());
nBuilder.setLights(Color.CYAN, 1000, 500);
The entire notification is working, like ContentTitle, ContentText and the notification is shown, but only the LED is not working.
Is there anything wrong with my code ? Should i use the Notification
instead NotificationCompact.Builder
?
Builder class for NotificationCompat objects. Allows easier control over all the flags, as well as help constructing the typical notification layouts. On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect.
Set the small icon resource, which will be used to represent the notification in the status bar. Set the small icon, which will be used to represent the notification in the status bar and content view (unless overridden there by a large icon ).
To turn on the setting for a development device running Android 8.0 (API level 26), navigate to Settings > Developer options and enable Show notification channel warnings.
The LED light for notifications is turned on by the OS in the device only if the notification is triggered while the device screen is off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With