I have an activity class that should get the interrupt filter setting of the current device.
Therefore, I have a class MyNotificationListenerService that comes from NotificationListenerService and implements onInterruptionFilterChanged ().
However, onInterruptionFilterChanged() is called only when the interrupt filter changes. When my application starts, I need to find out what the current value of the interrupt filter is. NotificationListenerService has a method for this getCurrentInterruptionFilter() .
My question is: how MyActivity call MyNotificationListenerService getCurrentInterruptionFilter() when the application starts?
The OS automatically creates and runs MyNotificationListenerService , can MyActivity ever get a handle to this object to explicitly call getCurrentInterruptionFilter() ? If not, what communication mechanism should be in order for MyActivity to get the initial interrupt setting from MyNotificationListenerService ?
.
source share