Aracılığıyla paylaş


NotificationListenerService.CancelNotification Method

Definition

Overloads

CancelNotification(String)

Inform the notification manager about dismissal of a single notification.

CancelNotification(String, String, Int32)
Obsolete.

Inform the notification manager about dismissal of a single notification.

CancelNotification(String)

Inform the notification manager about dismissal of a single notification.

[Android.Runtime.Register("cancelNotification", "(Ljava/lang/String;)V", "")]
public void CancelNotification (string? key);
[<Android.Runtime.Register("cancelNotification", "(Ljava/lang/String;)V", "")>]
member this.CancelNotification : string -> unit

Parameters

key
String

Notification to dismiss from StatusBarNotification#getKey().

Attributes

Remarks

Inform the notification manager about dismissal of a single notification.

Use this if your listener has a user interface that allows the user to dismiss individual notifications, similar to the behavior of Android's status bar and notification panel. It should be called after the user dismisses a single notification using your UI; upon being informed, the notification manager will actually remove the notification and you will get an #onNotificationRemoved(StatusBarNotification) callback.

<b>Note:</b> If your listener allows the user to fire a notification's android.app.Notification#contentIntent by tapping/clicking/etc., you should call this method at that time if the Notification in question has the android.app.Notification#FLAG_AUTO_CANCEL flag set.

The service should wait for the #onListenerConnected() event before performing this operation.

Java documentation for android.service.notification.NotificationListenerService.cancelNotification(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CancelNotification(String, String, Int32)

Caution

deprecated

Inform the notification manager about dismissal of a single notification.

[Android.Runtime.Register("cancelNotification", "(Ljava/lang/String;Ljava/lang/String;I)V", "")]
[System.Obsolete("deprecated")]
public void CancelNotification (string? pkg, string? tag, int id);
[<Android.Runtime.Register("cancelNotification", "(Ljava/lang/String;Ljava/lang/String;I)V", "")>]
[<System.Obsolete("deprecated")>]
member this.CancelNotification : string * string * int -> unit

Parameters

pkg
String

Package of the notifying app.

tag
String

Tag of the notification as specified by the notifying app in android.app.NotificationManager#notify(String, int, android.app.Notification).

id
Int32

ID of the notification as specified by the notifying app in android.app.NotificationManager#notify(String, int, android.app.Notification). <p>

Attributes

Remarks

Inform the notification manager about dismissal of a single notification.

Use this if your listener has a user interface that allows the user to dismiss individual notifications, similar to the behavior of Android's status bar and notification panel. It should be called after the user dismisses a single notification using your UI; upon being informed, the notification manager will actually remove the notification and you will get an #onNotificationRemoved(StatusBarNotification) callback.

<b>Note:</b> If your listener allows the user to fire a notification's android.app.Notification#contentIntent by tapping/clicking/etc., you should call this method at that time if the Notification in question has the android.app.Notification#FLAG_AUTO_CANCEL flag set.

The service should wait for the #onListenerConnected() event before performing this operation.

This member is deprecated. Use #cancelNotification(String key) instead. Beginning with android.os.Build.VERSION_CODES#LOLLIPOP this method will no longer cancel the notification. It will continue to cancel the notification for applications whose targetSdkVersion is earlier than android.os.Build.VERSION_CODES#LOLLIPOP.

Java documentation for android.service.notification.NotificationListenerService.cancelNotification(java.lang.String, java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to