Lollipop Notification setVisibility() Does Not Work?

自作多情 提交于 2019-11-30 11:13:34
Tanis.7x

The behavior you are describing is consistent with the behavior I experience when I set my lockscreen notification preference to "show all notification content."

This setting has three options:

  • Show all notification content makes all notifications (regardless of visibility) effectively public.

  • Hide sensitive notification content respects the new visibility types.

  • Don't show notifications at all will make all notifications effectively secret.

The option to change your lockscreen notification visiblity is in the device settings under Sound & Notifications > "When device is locked", as shown below.

As Selvin noted in his answer, the option to hide sensitive content is only available if you have set some sort of device lock (such as a PIN or pattern lock). If you can unlock your device with a simple swipe of the lockscreen, this option is not available.

Setting NotificationBuilder#setPriority(Notification.PRIORITY_MIN); also prevents a notification from being shown on the lock screen.

Surprising, but at least it was well documented.

In addition to Tanis.7x's answer: You have to chose any Lockscreen guard other than Swipe to "Hide sensitive notification content" option appear under Sound & Notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!