Android Lollipop - 如何让通知显示在通知抽屉上而不是状态栏上?

Android Lollipop - How to make Notifications show on the Notification Drawer but not on the Status Bar?

在我的 HTC One M7、Android 5.0.2、HTC Sense 6.0 上,有些通知显示在通知抽屉中,但不显示在状态栏上(也不显示在锁定屏幕上) .例如,Google 现在天气信息和 Facebook Messenger "Chat heads active."

它们可以是持续的,也可以是一次性的。

我找不到这方面的任何文档。如何创建此类通知?

使用PRIORITY_MIN with setPriority() as explained in the notifications design guidelines:

MIN: Use for contextual or background information such as weather information or contextual location information. Minimum-priority notifications do not appear in the status bar. The user discovers them on expanding the notification shade.

使用NotificationCompat.Builder:

mBuilder.setPriority(NotificationCompat.PRIORITY_MIN);