skm_notification_listener

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

skm notification listener

skm_notification_listener #
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:
skm_notification_listener: any # or the latest version on Pub
copied to clipboard
Inside AndroidManifest add this to bind notification service with your application
<service
android:label="notifications"
android:name="skm.notification_listener.skm_notification_listener.NotificationListener"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
copied to clipboard
USAGE #
/// check if notification permission is enabled
final bool status = await SkmNotificationListener.isPermissionGranted();

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

/// stream the incoming notification events
SkmNotificationListener.notificationsStream.listen((event) {
log("Current notification: $event");
});
copied to clipboard
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)

copied to clipboard
To reply to a notification provides:
try {
await event.sendReply("This is an auto response");
} catch (e) {
log(e.toString());
}

copied to clipboard
Screenshots #

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.