即使我将中断过滤器设置为优先级,但我仍试图听到警报,但此刻我只能打开一个或另一个。
我已经研究过使用NotificationManager.Policy,PRIORITY_CATEGORY_ALARMS和INTERRUPTION_FILTER_PRIORITY,但是问题是只能从API 28获得此功能,我想知道是否可以通过API 23同时获得Priority和Alarms。 / p>
我的优先级过滤器代码为:
mNotificationManager.setInterruptionFilter(
NotificationManager.INTERRUPTION_FILTER_PRIORITY);
我的警报过滤器代码为:
mNotificationManager.setInterruptionFilter(
NotificationManager.INTERRUPTION_FILTER_ALARMS);
对于API 28及更高版本:
notificationManager.setNotificationPolicy(
new NotificationManager.Policy(NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS,
NotificationManager.Policy.PRIORITY_SENDERS_ANY,
NotificationManager.Policy.PRIORITY_SENDERS_ANY));
notificationManager.setInterruptionFilter(
NotificationManager.INTERRUPTION_FILTER_PRIORITY);
如何从API 23获得优先级和警报?
我假设如果我同时使用两个中断过滤器,则只有第二个过滤器会起作用,因为它将排除第一个过滤器。可以解决这个问题吗?