Why is setInterruptFilter not working?

android android-studio

390 просмотра

1 ответ

148 Репутация автора

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 Источник Размещён: 13.07.2016 07:16

Ответы (1)


0 плюса

148 Репутация автора

Решение

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

Автор: Kyle Sweet Размещён: 28.07.2016 11:56
Вопросы из категории :
32x32