![]() They are defined by HW and LPG (Led Pattern Generator) so that they work also in deep sleep when CPU is more or less off and so the patterns and colors supported depend on the HW you have. Note: the color and on/off times do not really work for at least for blinking leds. Everything else in the notification works when set at anytime. For some strange reason the notification needs to be set at this time or the led doesn't work. NotificationTest.nm.cancel(NOTIFICATION_ID) Public class ScreenOnListener extends BroadcastReceiver Notif.flags = Notification.FLAG_SHOW_LIGHTS Public void onReceive(Context paramContext, Intent paramIntent) Then add set and cancel of the notification on those listeners: public class ScreenOffListener extends BroadcastReceiver RegisterReceiver(this.screenOffListener, new IntentFilter("_OFF")) I finally found a solution though setup listeners to screen on and off events: registerReceiver(this.screenOnListener, new IntentFilter("_ON")) I also fought with this for ages! Leds worked nicely in Samsung devices but on others, no luck at all. The screen IS off when I run the tests and all other apps on the phones trigger the lights without issue. I have now tested this on two stock Galaxy Nexus phones and the light works on neither. Notification notification = builder.getNotification() setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND | Notification.FLAG_SHOW_LIGHTS) Notification.Builder builder = new Notification.Builder(context) Vibration and Sound works again but not lights. 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. Notification.flags |= Notification.FLAG_AUTO_CANCEL Notification.flags |= Notification.FLAG_SHOW_LIGHTS tLatestEventInfo(context, "My Title", "My Message", pendingIntent) ![]() New Notification(R.drawable.ic_launcher, "My Ticker!",System.currentTimeMillis()) On the 4.0 Galaxy Nexus the lights do not work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |