Android 通知 LED 不使用我的颜色

标签 android notifications led

我正在尝试使用一个通知,该通知也使用我的 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/

相关文章:

c - LED 8x8 的程序在 Arduino Uno 中不起作用。我没有使用 pinMode() 方法。我正在使用另一种方法进行规范

android - 在 Android 的 okhttp 中向 GET 请求添加查询参数

iOS -- 我想更改语言警报推送通知

java - 后台服务的延迟通知

c# - 是否可以从控制台应用程序发送 Toast 通知?

android - Firebase 通知 LED 闪烁

c - 了解stm32f334R8的LED灯代码?

android - 如何在不打开新浏览器的情况下从 webview 下载 apk 文件

Android 多线程单元测试

android - Android中如何绘制两种颜色的圆弧