Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NotificationCompat.Builder setLights(); not working

Tags:

android

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 ?

like image 857
Gabriel Muraoka Avatar asked Aug 13 '14 00:08

Gabriel Muraoka


People also ask

What is NotificationCompat 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.

How do I make my notification icons smaller?

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 ).

How do I create a notification channel?

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.


1 Answers

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.

like image 128
murki Avatar answered Sep 30 '22 14:09

murki