isNotificationActiveOnStatusBar method
Checks whether a notification with the specified ID is currently active on the device's status bar.
This method takes an integer id argument representing the ID of the notification to be checked. It returns a Future that resolves to a bool value indicating whether the specified notification is currently active on the device's status bar. If the notification is active, the value will be true. If the notification is not active, the value will be false.
This method can be used to check whether a specific notification is currently being displayed on the device's status bar. If the notification is not active, you may want to take appropriate action, such as re-creating the notification or displaying a message to the user.
Note: In order to use this method, you need to have the appropriate permissions
set in your AndroidManifest.xml file. Specifically, you need to have the
android.permission.ACCESS_NOTIFICATION_POLICY
permission declared in your manifest
in order to access the device's notification policy.
Implementation
@override
Future<bool> isNotificationActiveOnStatusBar({required int id}) async {
var success = await methodChannel.invokeMethod(
CHANNEL_METHOD_IS_NOTIFICATION_ACTIVE, id);
return success;
}