# NotificationManagerCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Constants](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#constants)\|[Methods](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#)  

# NotificationManagerCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
NotificationManagerCompat
`  
`

extends Object


``


`

|---|--------------------------------------------------|
| java.lang.Object                                    ||
| ↳ | android.support.v4.app.NotificationManagerCompat |

<br />

*** ** * ** ***

Compatibility library for NotificationManager with fallbacks for older platforms.

To use this class, call the static function[from(Context)](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#from(android.content.Context))to get a[NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat)object, and then call one of its methods to post or cancel notifications.

## Summary

|                                                                                                                                            ### Constants                                                                                                                                             ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `String` | [ACTION_BIND_SIDE_CHANNEL](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#ACTION_BIND_SIDE_CHANNEL) Intent action to register for on a service to receive side channel notifications.                                                            |
| `String` | [EXTRA_USE_SIDE_CHANNEL](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#EXTRA_USE_SIDE_CHANNEL) Notification extras key: if set to true, the posted notification should use the side channel for delivery instead of using notification manager. |
| `int`    | [IMPORTANCE_DEFAULT](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_DEFAULT) Default notification importance: shows everywhere, allowed to makes noise, but does not visually intrude.                                                |
| `int`    | [IMPORTANCE_HIGH](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_HIGH) Higher notification importance: shows everywhere, allowed to makes noise and peek.                                                                             |
| `int`    | [IMPORTANCE_LOW](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_LOW) Low notification importance: shows everywhere, but is not intrusive.                                                                                             |
| `int`    | [IMPORTANCE_MAX](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_MAX) Highest notification importance: shows everywhere, allowed to makes noise, peek, and use full screen intents.                                                    |
| `int`    | [IMPORTANCE_MIN](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_MIN) Min notification importance: only shows in the shade, below the fold.                                                                                            |
| `int`    | [IMPORTANCE_NONE](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_NONE) A notification with no importance: shows nowhere, is blocked.                                                                                                  |
| `int`    | [IMPORTANCE_UNSPECIFIED](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_UNSPECIFIED) Value signifying that the user has not expressed an importance.                                                                                  |

|                                                                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                                                                      ||
|---------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                                      | ` `[areNotificationsEnabled](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#areNotificationsEnabled())`() ` Returns whether notifications from the calling package are not blocked.                                                                                                                                                              |
| ` void`                                                                                                                         | ` `[cancel](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#cancel(java.lang.String, int))`(String tag, int id) ` Cancel a previously shown notification.                                                                                                                                                                                         |
| ` void`                                                                                                                         | ` `[cancel](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#cancel(int))`(int id) ` Cancel a previously shown notification.                                                                                                                                                                                                                       |
| ` void`                                                                                                                         | ` `[cancelAll](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#cancelAll())`() ` Cancel all previously shown notifications.                                                                                                                                                                                                                       |
| ` static `[NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat) | ` `[from](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#from(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Get a[NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat)instance for a provided context. |
| ` static Set<String>`                                                                                                           | ` `[getEnabledListenerPackages](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#getEnabledListenerPackages(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` Get the set of packages that have an enabled notification listener component within them.                      |
| ` int`                                                                                                                          | ` `[getImportance](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#getImportance())`() ` Returns the user specified importance for notifications from the calling package.                                                                                                                                                                        |
| ` void`                                                                                                                         | ` `[notify](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#notify(int, android.app.Notification))`(int id, `[Notification](https://developer.android.com/reference/android/app/Notification.html)` notification) ` Post a notification to be shown in the status bar, stream, etc.                                                               |
| ` void`                                                                                                                         | ` `[notify](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#notify(java.lang.String, int, android.app.Notification))`(String tag, int id, `[Notification](https://developer.android.com/reference/android/app/Notification.html)` notification) ` Post a notification to be shown in the status bar, stream, etc.                                 |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Constants

### ACTION_BIND_SIDE_CHANNEL

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String ACTION_BIND_SIDE_CHANNEL
```

Intent action to register for on a service to receive side channel notifications. The listening service must be in the same package as an enabled[NotificationListenerService](https://developer.android.com/reference/android/service/notification/NotificationListenerService.html).

<br />

Constant Value: "android.support.BIND_NOTIFICATION_SIDE_CHANNEL"  

### EXTRA_USE_SIDE_CHANNEL

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String EXTRA_USE_SIDE_CHANNEL
```

Notification extras key: if set to true, the posted notification should use the side channel for delivery instead of using notification manager.

<br />

Constant Value: "android.support.useSideChannel"  

### IMPORTANCE_DEFAULT

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_DEFAULT
```

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

<br />

Constant Value: 3 (0x00000003)  

### IMPORTANCE_HIGH

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_HIGH
```

Higher notification importance: shows everywhere, allowed to makes noise and peek.

<br />

Constant Value: 4 (0x00000004)  

### IMPORTANCE_LOW

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_LOW
```

Low notification importance: shows everywhere, but is not intrusive.

<br />

Constant Value: 2 (0x00000002)  

### IMPORTANCE_MAX

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_MAX
```

Highest notification importance: shows everywhere, allowed to makes noise, peek, and use full screen intents.

<br />

Constant Value: 5 (0x00000005)  

### IMPORTANCE_MIN

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_MIN
```

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

<br />

Constant Value: 1 (0x00000001)  

### IMPORTANCE_NONE

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_NONE
```

A notification with no importance: shows nowhere, is blocked.

<br />

Constant Value: 0 (0x00000000)  

### IMPORTANCE_UNSPECIFIED

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int IMPORTANCE_UNSPECIFIED
```

Value signifying that the user has not expressed an importance. This value is for persisting preferences, and should never be associated with an actual notification.

<br />

Constant Value: -1000 (0xfffffc18)

## Public methods

### areNotificationsEnabled

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean areNotificationsEnabled ()
```

Returns whether notifications from the calling package are not blocked.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### cancel

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void cancel (String tag, 
                int id)
```

Cancel a previously shown notification.

<br />

|                             Parameters                             ||
|-------|-------------------------------------------------------------|
| `tag` | `String`: the string identifier of the notification. <br /> |
| `id`  | `int`: the ID of the notification <br />                    |

### cancel

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void cancel (int id)
```

Cancel a previously shown notification.

<br />

|                   Parameters                   ||
|------|------------------------------------------|
| `id` | `int`: the ID of the notification <br /> |

### cancelAll

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void cancelAll ()
```

Cancel all previously shown notifications.

<br />

### from

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationManagerCompat from (Context context)
```

Get a[NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat)instance for a provided context.

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

|                                                            Returns                                                            ||
|-----------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat) | <br /> |

### getEnabledListenerPackages

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Set<String> getEnabledListenerPackages (Context context)
```

Get the set of packages that have an enabled notification listener component within them.

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

|        Returns        ||
|---------------|--------|
| `Set<String>` | <br /> |

### getImportance

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getImportance ()
```

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

<br />

|                                                                                   Returns                                                                                    ||
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | An importance level, such as[IMPORTANCE_DEFAULT](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat#IMPORTANCE_DEFAULT). <br /> |

### notify

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void notify (int id, 
                Notification notification)
```

Post a notification to be shown in the status bar, stream, etc.

<br />

|                                  Parameters                                   ||
|----------------|---------------------------------------------------------------|
| `id`           | `int`: the ID of the notification <br />                      |
| `notification` | `Notification`: the notification to post to the system <br /> |

### notify

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void notify (String tag, 
                int id, 
                Notification notification)
```

Post a notification to be shown in the status bar, stream, etc.

<br />

|                                                  Parameters                                                  ||
|----------------|----------------------------------------------------------------------------------------------|
| `tag`          | `String`: the string identifier for a notification. Can be`null`. <br />                     |
| `id`           | `int`: the ID of the notification. The pair (tag, id) must be unique within your app. <br /> |
| `notification` | `Notification`: the notification to post to the system <br />                                |

-

  ## Annotations

  - [NotificationCompat.Action.SemanticAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.SemanticAction)
-

  ## Interfaces

  - [ActionBarDrawerToggle.Delegate](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.Delegate)
  - [ActionBarDrawerToggle.DelegateProvider](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.DelegateProvider)
  - [ActivityCompat.OnRequestPermissionsResultCallback](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.OnRequestPermissionsResultCallback)
  - [ActivityCompat.PermissionCompatDelegate](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.PermissionCompatDelegate)
  - [FragmentManager.BackStackEntry](https://developer.android.com/reference/android/support/v4/app/FragmentManager.BackStackEntry)
  - [FragmentManager.OnBackStackChangedListener](https://developer.android.com/reference/android/support/v4/app/FragmentManager.OnBackStackChangedListener)
  - [LoaderManager.LoaderCallbacks](https://developer.android.com/reference/android/support/v4/app/LoaderManager.LoaderCallbacks)
  - [NotificationCompat.Action.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Extender)
  - [NotificationCompat.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Extender)
  - [SharedElementCallback.OnSharedElementsReadyListener](https://developer.android.com/reference/android/support/v4/app/SharedElementCallback.OnSharedElementsReadyListener)
  - [TaskStackBuilder.SupportParentable](https://developer.android.com/reference/android/support/v4/app/TaskStackBuilder.SupportParentable)
-

  ## Classes

  - [ActionBarDrawerToggle](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle)
  - [ActivityCompat](https://developer.android.com/reference/android/support/v4/app/ActivityCompat)
  - [ActivityManagerCompat](https://developer.android.com/reference/android/support/v4/app/ActivityManagerCompat)
  - [ActivityOptionsCompat](https://developer.android.com/reference/android/support/v4/app/ActivityOptionsCompat)
  - [AlarmManagerCompat](https://developer.android.com/reference/android/support/v4/app/AlarmManagerCompat)
  - [AppLaunchChecker](https://developer.android.com/reference/android/support/v4/app/AppLaunchChecker)
  - [AppOpsManagerCompat](https://developer.android.com/reference/android/support/v4/app/AppOpsManagerCompat)
  - [BundleCompat](https://developer.android.com/reference/android/support/v4/app/BundleCompat)
  - [DialogFragment](https://developer.android.com/reference/android/support/v4/app/DialogFragment)
  - [Fragment](https://developer.android.com/reference/android/support/v4/app/Fragment)
  - [Fragment.SavedState](https://developer.android.com/reference/android/support/v4/app/Fragment.SavedState)
  - [FragmentActivity](https://developer.android.com/reference/android/support/v4/app/FragmentActivity)
  - [FragmentContainer](https://developer.android.com/reference/android/support/v4/app/FragmentContainer)
  - [FragmentController](https://developer.android.com/reference/android/support/v4/app/FragmentController)
  - [FragmentHostCallback](https://developer.android.com/reference/android/support/v4/app/FragmentHostCallback)
  - [FragmentManager](https://developer.android.com/reference/android/support/v4/app/FragmentManager)
  - [FragmentManager.FragmentLifecycleCallbacks](https://developer.android.com/reference/android/support/v4/app/FragmentManager.FragmentLifecycleCallbacks)
  - [FragmentManagerNonConfig](https://developer.android.com/reference/android/support/v4/app/FragmentManagerNonConfig)
  - [FragmentPagerAdapter](https://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter)
  - [FragmentStatePagerAdapter](https://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter)
  - [FragmentTabHost](https://developer.android.com/reference/android/support/v4/app/FragmentTabHost)
  - [FragmentTransaction](https://developer.android.com/reference/android/support/v4/app/FragmentTransaction)
  - [FrameMetricsAggregator](https://developer.android.com/reference/android/support/v4/app/FrameMetricsAggregator)
  - [JobIntentService](https://developer.android.com/reference/android/support/v4/app/JobIntentService)
  - [ListFragment](https://developer.android.com/reference/android/support/v4/app/ListFragment)
  - [LoaderManager](https://developer.android.com/reference/android/support/v4/app/LoaderManager)
  - [NavUtils](https://developer.android.com/reference/android/support/v4/app/NavUtils)
  - [NotificationCompat](https://developer.android.com/reference/android/support/v4/app/NotificationCompat)
  - [NotificationCompat.Action](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action)
  - [NotificationCompat.Action.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Builder)
  - [NotificationCompat.Action.WearableExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.WearableExtender)
  - [NotificationCompat.BigPictureStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigPictureStyle)
  - [NotificationCompat.BigTextStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigTextStyle)
  - [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder)
  - [NotificationCompat.CarExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender)
  - [NotificationCompat.CarExtender.UnreadConversation](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender.UnreadConversation)
  - [NotificationCompat.CarExtender.UnreadConversation.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender.UnreadConversation.Builder)
  - [NotificationCompat.DecoratedCustomViewStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.DecoratedCustomViewStyle)
  - [NotificationCompat.InboxStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.InboxStyle)
  - [NotificationCompat.MessagingStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle)
  - [NotificationCompat.MessagingStyle.Message](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message)
  - [NotificationCompat.Style](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Style)
  - [NotificationCompat.WearableExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.WearableExtender)
  - [NotificationCompatExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompatExtras)
  - [NotificationCompatSideChannelService](https://developer.android.com/reference/android/support/v4/app/NotificationCompatSideChannelService)
  - [NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat)
  - [RemoteInput](https://developer.android.com/reference/android/support/v4/app/RemoteInput)
  - [RemoteInput.Builder](https://developer.android.com/reference/android/support/v4/app/RemoteInput.Builder)
  - [ServiceCompat](https://developer.android.com/reference/android/support/v4/app/ServiceCompat)
  - [ShareCompat](https://developer.android.com/reference/android/support/v4/app/ShareCompat)
  - [ShareCompat.IntentBuilder](https://developer.android.com/reference/android/support/v4/app/ShareCompat.IntentBuilder)
  - [ShareCompat.IntentReader](https://developer.android.com/reference/android/support/v4/app/ShareCompat.IntentReader)
  - [SharedElementCallback](https://developer.android.com/reference/android/support/v4/app/SharedElementCallback)
  - [TaskStackBuilder](https://developer.android.com/reference/android/support/v4/app/TaskStackBuilder)
-

  ## Exceptions

  - [Fragment.InstantiationException](https://developer.android.com/reference/android/support/v4/app/Fragment.InstantiationException)