Search packages, repositories and app categories

Package detailsv1.0.0

notification_listener_service

Flutter Plugin to listen to all incoming notifications (posted or removed) with the possibility to reply to them

Android
30-day downloads
3.7K
Likes
72
Pub points
160

Install package

flutter pub add notification_listener_service

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter plugin for Android that enables apps to listen to incoming notifications, including their posting and removal. It supports replying to notifications directly from the app, making it ideal for messaging or automation tools. The plugin leverages Android's NotificationListenerService API to monitor system notifications in real time. Developers can access notification details such as title, text, package name, and timestamp. It requires user permission to enable the listener service, ensuring privacy and security. Designed specifically for Android, it integrates seamlessly into existing Flutter projects.

Use cases

  • Real-time notification monitoring
  • Automated message replies
  • Notification-based workflows
  • App integration with system notifications
  • Privacy-aware notification tracking

Key features

  • Listens to all incoming and removed notifications
  • Supports direct reply functionality
  • Android-only platform compatibility
  • Secure permission-based access
  • Provides detailed notification metadata

Suitable for

  • Developers building notification automation tools
  • Apps requiring real-time notification insights
  • Messaging or chat applications
  • System-level Android integrations
  • Privacy-focused notification handlers

Considerations

  • Requires Android-specific setup and permissions
  • User must manually enable the listener service
  • Limited to Android platform
  • May impact battery life with continuous listening
  • Sensitive data access requires careful handling

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

notification_listener_service

A flutter plugin for interacting with Notification Service in Android.

NotificationListenerService is a service that receives calls from the system when new notifications are posted or removed,

for more info check NotificationListenerService

Installation and usage

Add package to your pubspec:

dependencies:
  notification_listener_service: any # or the latest version on Pub

Inside AndroidManifest add this to bind notification service with your application


<service android:label="notifications" android:name="notification.listener.service.NotificationListener"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" android:exported="true">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>


USAGE
 /// check if notification permession is enebaled
 final bool status = await NotificationListenerService.isPermissionGranted();

 /// request notification permission
 /// it will open the notifications settings page and return `true` once the permission granted.
 final bool status = await NotificationListenerService.requestPermission();

 /// stream the incoming notification events
  NotificationListenerService.notificationsStream.listen((event) {
    log("Current notification: $event");
  });

The ServiceNotificationEvent provides:

  /// the notification id
  int? id;

  /// check if we can reply the Notification
  bool? canReply;

  /// if the notification has an extras image
  bool? haveExtraPicture;

  /// if the notification has been removed
  bool? hasRemoved;

  /// notification extras image
  /// To display an image simply use the [Image.memory] widget.
  Uint8List? extrasPicture;

  /// notification large icon
  /// To display an image simply use the [Image.memory] widget.
  Uint8List? largeIcon;

  /// notification package name
  String? packageName;

  /// notification title
  String? title;

  /// the notification app icon
  /// To display an image simply use the [Image.memory] widget.
  Uint8List? appIcon;

  /// the content of the notification
  String? content;

  /// send a direct message reply to the incoming notification
  Future<bool> sendReply(String message)

To reply to a notification provides:

  try {
    await event.sendReply("This is an auto response");
  } catch (e) {
    log(e.toString());
  }

Example of the app on foreground

Find the exemple app Here

Screenshots

Categories

Source repository

Projects using this package