How to have LED Light Notification?
android
Solution
If you use setDefaults(DEFAULT_LIGHTS) or setDefaults(DEFAULT_ALL), it will ignore FLAG_SHOW_LIGHTS and any calls to setLights(). I found that on my phone, the defaults would not light up anything. So do not use DEFAULT_ALL or DEFAULT_LIGHTS, and play with the RGB color if necessary... although 0xff00ff00 should work in pretty much all cases.
Problem
Update: I am reworking the original post for compatibility before Android 3.0. I am trying to create a simple notification and everything but the light works great. I do have the screen off when the notification fires. Using this deprecated code sound and vibrations works on Android 4.0 (Galaxy Nexus) and Android 2.3 (HTC EVO). - On the 2.3 HTC EVO the lights also work. On the 4.0 Galaxy Nexus the lights do not work. ``` Notification notification = new Notification(R.drawable.ic_launcher, "My Ticker!",System.currentTimeMillis()); notification.setLatestEventInfo(context, "My Title", "My Message", pendingIntent); notification.defaults |= Notification.DEFAULT_SOUND; notification.defaults |= Notification.DEFAULT_VIBRATE; //notification.defaults |= Notification.DEFAULT_LIGHTS; notification.ledARGB = 0xff00ff00; notification.ledOnMS = 300; notification.ledOffMS = 1000; notification.flags |= Notification.FLAG_SHOW_LIGHTS; notification.flags |= Notification.FLAG_AUTO_CANCEL; ``` I have also tried newer APIs that are not part of the v4 compatibility library, so I could only test this on the Galaxy Nexus. Vibration and Sound works again but not lights. ``` Notification.Builder builder = new Notification.Builder(context); builder.setContentIntent(pendingIntent) .setSmallIcon(R.drawable.ic_launcher) .setTicker("My Ticker") .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND | Notification.FLAG_SHOW_LIGHTS) .setLights(0xff00ff00, 300, 100) .setContentTitle("My Title 1") .setContentText("My Text 1"); Notification notification = builder.getNotification(); ``` I have now tested this on two stock Galaxy Nexus phones and the light works on neither. The screen IS off when I run the tests and all other apps on the phones trigger the lights without issue.