NotificationCompat.Builder setLights();不工作 [英] NotificationCompat.Builder setLights(); not working

查看:79
本文介绍了NotificationCompat.Builder setLights();不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用通知中的LED,但它不起作用,我有以下代码:

I'm trying to use the LED on my notification and it's not working, i have this code:

NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(getApplicationContext());
nBuilder.setLights(Color.CYAN, 1000, 500);

整个通知都在工作,如ContentTitle,ContentText,并且显示了通知,但只有LED不工作.

The entire notification is working, like ContentTitle, ContentText and the notification is shown, but only the LED is not working.

我的代码有什么问题吗?我应该使用 Notification 还是 NotificationCompact.Builder 吗?

Is there anything wrong with my code ? Should i use the Notification instead NotificationCompact.Builder ?

推荐答案

仅当设备屏幕关闭时触发通知时,设备中的操作系统才会打开用于通知的LED灯.

The LED light for notifications is turned on by the OS in the device only if the notification is triggered while the device screen is off.

这篇关于NotificationCompat.Builder setLights();不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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