NotificationManager Class

Definition

Class to notify the user of events that happen.

[Android.Runtime.Register("android/app/NotificationManager", DoNotGenerateAcw=true)]
public class NotificationManager : Java.Lang.Object
[<Android.Runtime.Register("android/app/NotificationManager", DoNotGenerateAcw=true)>]
type NotificationManager = class
    inherit Object
Inheritance
NotificationManager
Attributes

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 cancel(int) or cancel(String,int) method to clear this notification. Developer Guides For a guide to creating notifications, read the Status Bar Notifications developer guide.

Android reference for android.app.NotificationManager.

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.

Constructors

Name Description
NotificationManager(IntPtr, JniHandleOwnership)

Initializes a managed representation of an existing Java Native Interface object.

Fields

Name Description
ActionAppBlockStateChanged

Intent that is broadcast when an application is blocked or unblocked.

ActionAutomaticZenRule

Activity Action: Launch an Automatic Zen Rule configuration screen Input: Optionally, EXTRA_AUTOMATIC_RULE_ID, if the configuration screen for an existing rule should be displayed.

ActionAutomaticZenRuleStatusChanged

Intent that is broadcast when the status of an AutomaticZenRule has changed.

ActionConsolidatedNotificationPolicyChanged

Intent that is broadcast when the state of getConsolidatedNotificationPolicy() changes.

ActionInterruptionFilterChanged

Intent that is broadcast when the state of getCurrentInterruptionFilter() changes.

ActionNotificationChannelBlockStateChanged

Intent that is broadcast when a NotificationChannel is blocked (when NotificationChannel.getImportance() is IMPORTANCE_NONE) or unblocked (when NotificationChannel.getImportance() is anything other than IMPORTANCE_NONE).

ActionNotificationChannelGroupBlockStateChanged

Intent that is broadcast when a NotificationChannelGroup is blocked or unblocked.

ActionNotificationPolicyAccessGrantedChanged

Intent that is broadcast when the state of isNotificationPolicyAccessGranted() changes.

ActionNotificationPolicyChanged

Intent that is broadcast when the state of getNotificationPolicy() changes.

AutomaticRuleStatusActivated
Obsolete.

Constant value for EXTRA_AUTOMATIC_ZEN_RULE_STATUS - the given rule has been activated by the user or cross device sync.

AutomaticRuleStatusDeactivated
Obsolete.

Constant value for EXTRA_AUTOMATIC_ZEN_RULE_STATUS - the given rule has been deactivated ("snoozed") by the user.

AutomaticRuleStatusDisabled
Obsolete.

Constant value for EXTRA_AUTOMATIC_ZEN_RULE_STATUS - the given rule currently exists but is disabled.

AutomaticRuleStatusEnabled
Obsolete.

Constant value for EXTRA_AUTOMATIC_ZEN_RULE_STATUS - the given rule currently exists and is enabled.

AutomaticRuleStatusRemoved
Obsolete.

Constant value for EXTRA_AUTOMATIC_ZEN_RULE_STATUS - the given rule has been deleted.

AutomaticRuleStatusUnknown
Obsolete.

Constant value for EXTRA_AUTOMATIC_ZEN_RULE_STATUS - the current status of the rule is unknown at your target sdk version, and you should continue to provide state changes via setAutomaticZenRuleState(String,Condition).

BubblePreferenceAll
Obsolete.

Indicates that all bubbles are allowed from the app.

BubblePreferenceNone
Obsolete.

Indicates that the no bubbles are allowed from the app.

BubblePreferenceSelected
Obsolete.

Indicates that only notifications selected by the user will appear as bubbles.

ExtraAutomaticRuleId

Used as an optional string extra on ACTION_AUTOMATIC_ZEN_RULE intents.

ExtraAutomaticZenRuleId

String extra for ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED containing the id of the AutomaticZenRule (see addAutomaticZenRule(AutomaticZenRule)) that has changed.

ExtraAutomaticZenRuleStatus

Integer extra for ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED containing the state of the AutomaticZenRule.

ExtraBlockedState

Extra for ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED or ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED containing the new blocked state as a boolean.

ExtraNotificationChannelGroupId

Extra for ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED containing the id of the NotificationChannelGroup which has a new blocked state.

ExtraNotificationChannelId

Extra for ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED containing the id of the NotificationChannel which has a new blocked state.

ExtraNotificationPolicy

Extra for ACTION_NOTIFICATION_POLICY_CHANGED and ACTION_CONSOLIDATED_NOTIFICATION_POLICY_CHANGED containing the new Policy value.

ImportanceDefault
Obsolete.

Default notification importance: shows everywhere, makes noise, but does not visually intrude.

ImportanceHigh
Obsolete.

Higher notification importance: shows everywhere, makes noise and peeks.

ImportanceLow
Obsolete.

Low notification importance: Shows in the shade, and potentially in the status bar (see shouldHideSilentStatusBarIcons()), but is not audibly intrusive.

ImportanceMax
Obsolete.

Higher notification importance: shows everywhere, makes noise and peeks.

ImportanceMin
Obsolete.

Min notification importance: only shows in the shade, below the fold.

ImportanceNone
Obsolete.

A notification with no importance: does not show in the shade.

ImportanceUnspecified
Obsolete.

Value signifying that the user has not expressed an importance.

MetaDataAutomaticRuleType

A required meta-data tag for activities that handle ACTION_AUTOMATIC_ZEN_RULE.

MetaDataRuleInstanceLimit

An optional meta-data tag for activities that handle ACTION_AUTOMATIC_ZEN_RULE.

Properties

Name Description
AutomaticZenRules

Returns AutomaticZenRules owned by the caller.

BubblePreference

Gets the bubble preference for the app.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ConsolidatedNotificationPolicy

Returns the currently applied notification policy.

CurrentInterruptionFilter

Gets the current notification interruption filter.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
Importance

Returns the user specified importance for notifications from the calling package.

IsNotificationPolicyAccessGranted

Checks the ability to modify Notification Policy for the calling package.

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniManagedPeerState (Inherited from JavaObject)
JniPeerMembers

Provides JNI binding infrastructure for Android.App.NotificationManager.

NotificationChannelGroups

Returns all notification channel groups belonging to the calling app.

NotificationChannels

Returns all notification channels belonging to the calling package.

NotificationDelegate

Returns the delegate that can post notifications on your behalf, if there currently is one.

NotificationPolicy

Gets the current user-specified default notification policy.

PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
ThresholdClass

Provides JNI binding infrastructure for Android.App.NotificationManager.

ThresholdType

Provides JNI binding infrastructure for Android.App.NotificationManager.

Methods

Name Description
AddAutomaticZenRule(AutomaticZenRule)

Creates the given zen rule.

AreAutomaticZenRulesUserManaged()

Returns true if users can independently and fully manage AutomaticZenRule rules.

AreBubblesAllowed()

This method was deprecated in API level 31.

AreBubblesEnabled()

Returns whether bubbles are enabled at the feature level for the current user.

AreNotificationsEnabled()

Returns whether notifications from the calling package are enabled.

AreNotificationsPaused()

Returns whether notifications from this package are temporarily hidden.

Cancel(Int32)

Cancels a previously posted notification.

Cancel(String, Int32)

Cancels a previously posted notification.

CancelAll()

Cancel all previously shown notifications.

CancelAsPackage(String, String, Int32)

Cancels a previously posted notification.

CanNotifyAsPackage(String)

Returns whether you are allowed to post notifications on behalf of a given package, with notifyAsPackage(String,String,int,Notification).

CanPostPromotedNotifications()

Returns whether the calling app's properly formatted notifications can appear in a promoted format, which may result in higher ranking, appearances on additional surfaces, and richer presentation.

CanUseFullScreenIntent()

Returns whether the calling app can send fullscreen intents.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Construct(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
CreateNotificationChannel(NotificationChannel)

Creates a notification channel that notifications can be posted to.

CreateNotificationChannelGroup(NotificationChannelGroup)

Creates a group container for NotificationChannel objects.

CreateNotificationChannelGroups(IList<NotificationChannelGroup>)

Creates multiple notification channel groups.

CreateNotificationChannels(IList<NotificationChannel>)

Creates multiple notification channels that different notifications can be posted to.

DeleteNotificationChannel(String)

Deletes the given notification channel.

DeleteNotificationChannelGroup(String)

Deletes the given notification channel group, and all notification channels that belong to it.

Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
DisposeUnlessReferenced() (Inherited from JavaObject)
Equals(Object) (Inherited from JavaObject)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FromContext(Context)
GetActiveNotifications()

Recover a list of active notifications: ones that have been posted by the calling app that have not yet been dismissed by the user or cancel(String,int)ed by the app.

GetAutomaticZenRule(String)

Returns the AutomaticZenRule with the given id, if it exists and the caller has access.

GetAutomaticZenRuleState(String)

Returns the current activation state of an AutomaticZenRule.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetNotificationChannel(String, String)

Returns the notification channel settings for a given channel and conversation id.

GetNotificationChannel(String)

Returns the notification channel settings for a given channel id.

GetNotificationChannelGroup(String)

Returns the notification channel group settings for a given channel group id.

IsNotificationListenerAccessGranted(ComponentName)

Checks whether the user has approved a given NotificationListenerService.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
MatchesCallFilter(Uri)

Returns whether a call from the provided URI is permitted to notify the user.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
Notify(Int32, Notification)

Post a notification to be shown in the status bar.

Notify(String, Int32, Notification)

Posts a notification to be shown in the status bar.

NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
NotifyAsPackage(String, String, Int32, Notification)

Posts a notification as a specified package to be shown in the status bar.

RemoveAutomaticZenRule(String)

Deletes the automatic zen rule with the given id.

SetAutomaticZenRuleState(String, Condition)

Informs the notification manager that the state of an AutomaticZenRule has changed.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetInterruptionFilter(InterruptionFilter)

Sets the current notification interruption filter.

SetPeerReference(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
ShouldHideSilentStatusBarIcons()

Returns whether the user wants silent notifications (see IMPORTANCE_LOW to appear in the status bar.

ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
UpdateAutomaticZenRule(String, AutomaticZenRule)

Updates the given zen rule.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed() (Inherited from JavaObject)
IJavaPeerable.Finalized() (Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock (Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from JavaObject)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to