Android notification LED does not use my color

I am trying to use a notification that also uses the notification LED on my S3, but for some reason the color will always be blue (I assume this is the default value?). I tried to use different colors, but nothing has changed. Other applications (such as Whatsapp, Gmail and Facebook do not have problems displaying a different color).

Notification.Builder noteBuilder = new Notification.Builder(context) .setAutoCancel(true) .setPriority(Notification.PRIORITY_DEFAULT) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(ContentTitle) .setContentText(ContentText) .setLights(Color.YELLOW, 500, 500) ; Intent noteIntent = new Intent(context,HoofdScherm.class); PendingIntent notePendingIntent = PendingIntent.getActivity(context, 0, noteIntent, PendingIntent.FLAG_CANCEL_CURRENT); noteBuilder.setContentIntent(notePendingIntent); Notification note = noteBuilder.build(); note.ledARGB = Color.YELLOW; NotificationManager mgr = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); mgr.notify(0,note); 
+8
android notifications led
source share
2 answers

You need to make sure that all default values ​​are overridden by the setting

notification.defaults = 0;

+11
source share

Look at the source below. Works well on S3:

  NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx) .setPriority(Notification.PRIORITY_HIGH) .setSmallIcon(getNotificationIcon()) .setColor(0xff493C7C) .setContentTitle(ctx.getString(R.string.app_name)) .setContentText(msg) .setDefaults(Notification.DEFAULT_SOUND) .setLights(0xff493C7C, 1000, 1000) .setStyle(new NotificationCompat.BigTextStyle().bigText(styledMsg)); 
-one
source share

All Articles