Observe android notification being posted / removed using this NotificationListenerService wrapper for capacitor.
I created a capacitor plugin that enables to watch notifications being posted or removed. Read the documentation on GitHub.
⚠️ DISCLAIMER ⚠️
This plugin and project is deprecated as of August 30st 2024 and will probably not work in it’s current form. The GitHub repository is archived.
Unfortunately, the plugin does not support running in the background. This is a conscious design choice, so that you are able to choose or implement your preferred method of “running in the background” yourself. The plugin capacitor-persistent-notification could help you with such an endeavor.
Install the plugin using:
npm i capacitor-notificationlistener
npx cap sync
And register it using add(NotificationListenerPlugin.class) in your MainActivity.java like in the following example:
// ... code ...
import ch.asinz.capacitornotificationlistener.NotificationListenerPlugin;
// ... code ...
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Put it here!
add(NotificationListenerPlugin.class);
}});
// ... code ...
Please visit the documentation for further information.