0

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();

Also note that

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

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()) {...}

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

Kyle Sweet
  • 306
  • 1
  • 3
  • 15

1 Answers1

0

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

Kyle Sweet
  • 306
  • 1
  • 3
  • 15