Language

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

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). This value cannot be null.

tag
String

String: A string identifier for this notification. May be null.

id
Int32

int: An identifier for this notification.

Attributes

Remarks

Cancels a previously posted notification. If the notification does not currently represent a foreground service or a user-initiated job, it will be removed from the UI and live notification listeners will be informed so they can remove the notification from their UIs.

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

Android reference for android.app.NotificationManager.cancelAsPackage.

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