Android的通知LED不使用我的色彩 [英] Android Notification LED doesn't use my Color

查看:286
本文介绍了Android的通知LED不使用我的色彩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用同样使用该通知对我的S3 LED通知书,但由于某些原因的颜色永远是蓝色的(我想这是默认?)。我试图用不同的颜色,但没有改变。其他应用程序(如WhatsApp的时,Gmail和Facebook都没有问题呈现出不同颜色的光)。

  Notification.Builder noteBuilder =新Notification.Builder(上下文)
                .setAutoCancel(真)
                .setPriority(Notification.PRIORITY_DEFAULT)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentTitle(ContentTitle)
                .setContentText(ContentText)
                .setLights(Color.YELLOW,500,500)
                ;

意图noteIntent =新的意图(背景下,HoofdScherm.class);
PendingIntent notePendingIntent = PendingIntent.getActivity(上下文,0,noteIntent,PendingIntent.FLAG_CANCEL_CURRENT);
noteBuilder.setContentIntent(notePendingIntent);

通知注= noteBuilder.build();
note.ledARGB = Color.YELLOW;
NotificationManager经理=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
mgr.notify(0注);
 

解决方案

您需要确保所有的默认值被设置覆盖

notification.defaults = 0;

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);

解决方案

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

notification.defaults = 0;

这篇关于Android的通知LED不使用我的色彩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆