notifications 2.0.0+1 copy "notifications: ^2.0.0+1" to clipboard
notifications: ^2.0.0+1 copied to clipboard

outdated

A plugin for tracking notifications on the device. Works exclusively for Android.

Notifications #

pub package

A plugin for monitoring notification on Android.

Install #

Add notifications as a dependency in pubspec.yaml.

For help on adding as a dependency, view the documentation.

Usage #

All incoming data points are streamed with a StreamSubscription which is set up by calling the listen() method on the notificationStream stream object.

Given a method onData(NotificationEvent event) the subscription can be set up as follows:

Notifications _notifications;
StreamSubscription<NotificationEvent> _subscription;
...
void onData(NotificationEvent event) {
    print(event);
}

void startListening() {
    _notifications = new Notifications();
    try {
      _subscription = _notifications!.notificationStream!.listen(onData);
    } on NotificationException catch (exception) {
      print(exception);
    }
}

The stream can also be cancelled again by calling the cancel() method:

  void stopListening() {
    _subscription?.cancel();
  }

The NotificationEvent provides:

  • the title
  • the message
  • package name
  • timestamp

of each notification.

78
likes
0
pub points
83%
popularity

Publisher

verified publishercachet.dk

A plugin for tracking notifications on the device. Works exclusively for Android.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on notifications