Compartilhar via


NotificationManager.Cancel Method

Definition

Overloads

Cancel(Int32)

Cancels a previously posted notification.

Cancel(String, Int32)

Cancels a previously posted notification.

Cancel(Int32)

Cancels a previously posted notification.

[Android.Runtime.Register("cancel", "(I)V", "GetCancel_IHandler")]
public virtual void Cancel (int id);
[<Android.Runtime.Register("cancel", "(I)V", "GetCancel_IHandler")>]
abstract member Cancel : int -> unit
override this.Cancel : int -> unit

Parameters

id
Int32

An identifier for this notification (unique within your application).

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.

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

Cancel(String, Int32)

Cancels a previously posted notification.

[Android.Runtime.Register("cancel", "(Ljava/lang/String;I)V", "GetCancel_Ljava_lang_String_IHandler")]
public virtual void Cancel (string? tag, int id);
[<Android.Runtime.Register("cancel", "(Ljava/lang/String;I)V", "GetCancel_Ljava_lang_String_IHandler")>]
abstract member Cancel : string * int -> unit
override this.Cancel : string * int -> unit

Parameters

tag
String

A string identifier for this notification. May be null.

id
Int32

An identifier for this notification. The pair (tag , id) must be unique within your application.

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.

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