我正在尝试使用一个通知,该通知也使用我的 S3 上的通知 LED,但出于某种原因,颜色将始终为蓝色(我想这是默认设置?)。我尝试使用不同的颜色,但没有任何变化。其他应用程序(如 Whatsapp、Gmail 和 Facebook 在显示不同颜色的光时没有问题)。
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);
最佳答案
您需要确保通过设置覆盖所有默认值
notification.defaults = 0;
关于Android 通知 LED 不使用我的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14953793/