NotificationListenerService.CancelNotification Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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
.
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.