I am trying to use the Android function setInterruptFilter (), but the behavior is unstable. The following sample code, where I just install / get, gives 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();
Also note that
INTERRUPTION_FILTER_ALL = 1; INTERRUPTION_FILTER_NONE = 3; INTERRUPTION_FILTER_PRIORITY = 2;
I go through the [painful] resolution process, every time I download my application through ADB, I manually go into the settings and grant my permission to access notifications. I can also check this permission in code.
if (!mNotificationManager.isNotificationPolicyAccessGranted()) {...}
I get only the correct output when I start in the state where INTERRUPTION_FILTER_ALL (== 1). What could be happening here?
android android-studio
Kyle sweet
source share