【发布时间】:2019-09-13 11:18:24
【问题描述】:
我正在使用此代码设置中断过滤器:
NotificationManager myNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
myNotificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_PRIORITY);
它在每台设备上都运行良好,但由于某些原因,它不适用于使用 Android 9 的 小米 设备。请勿打扰模式未激活设备。它保持不变。如果我问设备当前的中断是什么,它会以 5 的值回答它。这是一个未知且未记录在 Android 开发人员中的值,如 here 所述。
int iCurrentInterruption = oNotificationManager.getCurrentInterruptionFilter();
iCurrentInterruption 的值为 5。以下都不是:
INTERRUPTION_FILTER_UNKNOWN = 0
INTERRUPTION_FILTER_ALL = 1
INTERRUPTION_FILTER_PRIORITY = 2
INTERRUPTION_FILTER_NONE = 3
INTERRUPTION_FILTER_ALARMS = 4
【问题讨论】:
标签: android xiaomi do-not-disturb