Partager via


NotificationManager.CancelAsPackage(String, String, Int32) Method

Definition

Cancels a previously posted notification.

[Android.Runtime.Register("cancelAsPackage", "(Ljava/lang/String;Ljava/lang/String;I)V", "GetCancelAsPackage_Ljava_lang_String_Ljava_lang_String_IHandler", ApiSince=30)]
public virtual void CancelAsPackage (string targetPackage, string? tag, int id);
[<Android.Runtime.Register("cancelAsPackage", "(Ljava/lang/String;Ljava/lang/String;I)V", "GetCancelAsPackage_Ljava_lang_String_Ljava_lang_String_IHandler", ApiSince=30)>]
abstract member CancelAsPackage : string * string * int -> unit
override this.CancelAsPackage : string * string * int -> unit

Parameters

targetPackage
String

The package to cancel the notification as. If this package is not your package, you can only cancel notifications you posted with #notifyAsPackage(String, String, int, Notification). @param tag A string identifier for this notification. May be {@code null.

tag
String
id
Int32

An identifier for this notification.

Attributes

Remarks

Cancels a previously posted notification.

If the notification does not currently represent a Service#startForeground(int, Notification) foreground service or a android.app.job.JobInfo.Builder#setUserInitiated(boolean) user-initiated job, it will be removed from the UI and live android.service.notification.NotificationListenerService notification listeners will be informed so they can remove the notification from their UIs.

This method may be used by #getNotificationDelegate() a notification delegate to cancel notifications that they have posted via #notifyAsPackage(String, String, int, Notification).

Java documentation for android.app.NotificationManager.cancelAsPackage(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