Android L通知优先级

时间:2014-10-22 19:31:14

标签: android notifications android-5.0-lollipop

我正在开发一个应用程序,当显示其他通知时应该更改通知LED指示灯。一切都适用于低于L的Android版本但是在LI上我无法使我的通知闪烁,相反,即使我的通知的优先级为MAX且其他的只是HIGH,原始通知仍然会闪烁。

你可以帮我一点吗?感谢

Notification.Builder builder = new Notification.Builder(getApplicationContext());
builder.setContentTitle(String.format("%s found.", rule.getPattern()));
builder.setSmallIcon(R.drawable.ic_stat_small);
builder.setLights(rule.getColor(), 200, 100);
builder.setPriority(Notification.PRIORITY_MAX);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.L) {
    builder.setCategory(Notification.CATEGORY_MESSAGE);
}
if (preferences.vibration().get()) {
    builder.setVibrate(new long[]{0, 500, 500, 200, 500});
}
notificationManager.notify((int) (long) rule.getId(), builder.build());

1 个答案:

答案 0 :(得分:0)

您描述的问题是 Android 5.0 中的错误,现在已在 Android 5.1 中修复。您的代码对我来说似乎是正确的,应该在 5.1 上按预期工作。

相关问题