Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Notification LED doesn't use my Color

I'm 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 guess it's the default?). I tried to use different colors but nothing changes. Other apps (like Whatsapp, Gmail and Facebook have no problems with showing a different color light).

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);
like image 910
Luc Kolen Avatar asked Feb 19 '13 09:02

Luc Kolen


People also ask

How do I know what color my notification light is?

Settings > Display > LED indicator. Settings > Sound and notifications > LED indicator.

How do I change the LED notification on my Android?

If the LED indicator behavior does not work as intended, check the LED notification settings. Follow these steps to turn on LED notification: Navigate to Settings > Display & gestures > Notification light. Tap the setting to turn it On.


1 Answers

You need to make sure all the defaults are overridden by setting

notification.defaults = 0;

like image 187
Yalla T. Avatar answered Nov 01 '22 04:11

Yalla T.