Android Guides | Samples

Android.App.NotificationManager Class

Class to notify the user of events that happen.

See Also: NotificationManager

Syntax

[Android.Runtime.Register("android/app/NotificationManager", DoNotGenerateAcw=true)]
public class NotificationManager : Object

Remarks

Class to notify the user of events that happen. This is how you tell the user that something has happened in the background.

Notifications can take different forms:

  • A persistent icon that goes in the status bar and is accessible through the launcher, (when the user selects it, a designated Intent can be launched),
  • Turning on or flashing LEDs on the device, or
  • Alerting the user by flashing the backlight, playing a sound, or vibrating.

Each of the notify methods takes an int id parameter and optionally a String tag parameter, which may be null. These parameters are used to form a pair (tag, id), or (null, id) if tag is unspecified. This pair identifies this notification from your app to the system, so that pair should be unique within your app. If you call one of the notify methods with a (tag, id) pair that is currently active and a new set of notification parameters, it will be updated. For example, if you pass a new status bar icon, the old icon in the status bar will be replaced with the new one. This is also the same tag and id you pass to the NotificationManager.Cancel(Int32) or NotificationManager.Cancel(String,Int32) method to clear this notification.

You do not instantiate this class directly; instead, retrieve it through Context.GetSystemService(String).

Developer Guides

For a guide to creating notifications, read the Status Bar Notifications developer guide.

See Also

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.App.NotificationManager are listed below.

See Also: Object

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Cancel(Int32)
Cancel a previously shown notification.
Cancel(String, Int32)
Cancel a previously shown notification.
CancelAll()
Cancel all previously shown notifications.
static
FromContext(Context) : NotificationManager
Notify(Int32, Notification)
Post a notification to be shown in the status bar.
Notify(String, Int32, Notification)
Post a notification to be shown in the status bar.