为什么 setInterruptFilter 不起作用? [英] Why is setInterruptFilter not working?

查看:53
本文介绍了为什么 setInterruptFilter 不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Android 函数 setInterruptFilter(),但行为不稳定.下面的示例代码我只执行 set/get 会产生奇怪的结果:

I am trying to use the Android function setInterruptFilter(), but the behavior is erratic. The following example code where I just do set/get produces strange results:

int filter1 = mNotificationManager.getCurrentInterruptionFilter();

mNotificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL);
int filter2 = mNotificationManager.getCurrentInterruptionFilter();

mNotificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);
int filter3 = mNotificationManager.getCurrentInterruptionFilter();

mNotificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);
int filter4 = mNotificationManager.getCurrentInterruptionFilter();

还要注意

INTERRUPTION_FILTER_ALL = 1;
INTERRUPTION_FILTER_NONE = 3;
INTERRUPTION_FILTER_PRIORITY = 2;

我正在经历 [痛苦的] 权限过程,每次我通过 ADB 加载我的应用程序时,我都会手动进入设置并授予我的应用程序访问通知的权限.我也可以在代码中验证这个权限

I am going through the [painful] permission process where every time I load my app through ADB, I manually go into settings and grant my app permission to access notifications. I can verify this permission in code too

if (!mNotificationManager.isNotificationPolicyAccessGranted()) {...}

当我以 INTERRUPTION_FILTER_ALL (==1) 的状态开始时,我只会得到正确的输出.这里会发生什么?

I only get the correct output when I begin in a state where INTERRUPTION_FILTER_ALL (==1). What could be going on here?

推荐答案

因为 Oxygen O.S. 中的一个错误.在 3.2.2 版本中已解决

Because of a bug in Oxygen O.S. that was resolved in version 3.2.2

这篇关于为什么 setInterruptFilter 不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆