在过去的几天里,我尝试了许多尝试让LED通知灯工作的组合,它只在通知使用声音时才有效。没有声音 - >没有LED灯。有人有类似的问题吗?我在Nexus5x和nexus10上进行了测试,两者的行为方式相同。注意:通知会在状态栏中显示并显示,但不会显示。
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Notification.Builder notificationBuilder = new Notification.Builder(this)
.setSmallIcon(R.drawable.ic_stat_dog_avatar)
.setContentText(messageText)
.setAutoCancel(true)
.setContentTitle(messageTitle)
// when this is enabled, I see the led lights flashing, but the sound
// is there also
// .setSound(defaultSoundUri)
//with this or without, same effect
// .setDefaults(NotificationCompat.DEFAULT_LIGHTS)
.setLights(65280, 500, 500)
.setContentIntent(pendingIntent);