1

The following code works great on a Motorola Defy with Android 2.3.3 However it's not working on a Nexus 4. The LED itself should be fine, the app color led tester from the market works.

NotificationManager notif =  (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
final Notification notification = new Notification();
notification.ledARGB = Color.RED;
notification.ledOnMS = 1000;
notification.ledOffMS = 300;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;    
notif.notify(1, notification);

Does anybody know what will do the trick here?

syb0rg
  • 8,057
  • 9
  • 41
  • 81
AndyB
  • 556
  • 1
  • 9
  • 25

1 Answers1

3

I just have tested your code on my Nexus 4 and it's work. But before the test I have locked my phone. Probably this LED will be highlighted only when screen is off.

andrew
  • 6,533
  • 1
  • 22
  • 19
  • You are right: What does not work is: Start demo code, then lock the screen. What works is: Lock the screen, then fire the app... That's really strange. On the the Motoroly Defy both variants work. So I guess the code has to be edited to wait for the display to go off, then fire the notification... Any ideas how to handle that? – AndyB Mar 05 '13 at 10:25
  • I don't think that waiting for display go off is good idea. I thinks such type of notification should be used with text combination, so LED will be highlighted only when you want to notify user while phone's screen is off. If you still want to do such notification you can try to create BroadcastReceiver for screen off event. See how it can be done here: http://stackoverflow.com/questions/7714731/broadcastreceiver-for-screen-lock-not-being-triggered – andrew Mar 05 '13 at 18:43