【发布时间】:2016-05-13 16:49:54
【问题描述】:
在 Android 6 上,我尝试显示具有以下属性组合的通知:
- 文字标题和内容
- 可扩展的图片内容(见here和here)
- 不要在状态栏中显示通知图标(不想弄乱它)
- 不要让任何 LED 闪烁(不想给用户带来麻烦)
- 在锁屏上显示
- 以展开(或至少可展开)格式在锁屏上显示(显示 bigContentView)
我可以通过setPriority(Notification.PRIORITY_MIN) 实现 3 和 4,但是通知似乎根本没有显示在锁定屏幕上(5 失败)。
至于 6,当通知确实显示在锁屏上时,例如使用PRIORITY_MAX(通过 5 但在 3 和 4 上失败),它不可扩展甚至可扩展(在 6 上失败)。
我正在使用以下设置通知:
Notification notification = new NotificationCompat.Builder(context)
.setContentTitle(titleText)
.setContentText(contentText)
.setSmallIcon(R.drawable.small_icon)
.setOngoing(true)
.setPriority(Notification.PRIORITY_DEFAULT)
.setVisibility(Notification.VISIBILITY_PUBLIC)
.build();
// add the image content (via a remoteViews)...
notification.bigContentView = remoteViews;
notificationManager.notify(tag, id, notification);
【问题讨论】:
标签: android notifications