no matter what I tried but there is no notification light. I'm running Android 26 Oreo. My phone only displays blink light for messages and missed calls.
String CHANNEL_ID = "my_channel_01";
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
CharSequence name = "Name"; // The user-visible name of the channel.
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
mChannel = new NotificationChannel("my_channel_01", name, importance);
mChannel.enableLights(true);
mChannel.setLightColor(Color.GREEN);
mChannel.shouldShowLights();
nm.createNotificationChannel(mChannel);
}
Notification notif = new Notification.Builder(MainActivity.this)
.setSmallIcon(R.mipmap.ic_launcher_2)
.setContentTitle("Blhas")
.setContentText("Subject")
.setSubText("Subtext")
.setColor(Color.RED)
.setLights(255, 0, 0)
.setContentIntent(pIntent)
.setStyle(new Notification.BigTextStyle().bigText("..."))
.setChannelId(CHANNEL_ID)
.setPriority(Notification.PRIORITY_HIGH)
.build();
nm.notify(LED_NOTIFICATION_ID, notif);
Is there anyway to control the LED light?