1# Enabling Notification 2 3 4To publish a notification, you must have notification enabled for your application. You can call the [requestEnableNotification()](../reference/apis/js-apis-notificationManager.md#notificationrequestenablenotification) API to display a dialog box prompting the user to enable notification for your application. Note that the dialog box is displayed only when the API is called for the first time. 5 6 **Figure 1** Dialog box prompting the user to enable notification 7 8![en-us_image_0000001416585590](figures/en-us_image_0000001416585590.png) 9 10 11- Touching **allow** enables notification for the application, and touching **ban** keeps notification disabled. 12 13- The dialog box will not be displayed again when [requestEnableNotification()](../reference/apis/js-apis-notificationManager.md#notificationrequestenablenotification) is called later. The user can manually enable notification as follows. 14 15 | 1. Swipe down from the upper left corner of the device screen to access the notification panel. | 2. Touch the **Settings** icon in the upper right corner. On the notification screen, locate the target application.| 3. Toggle on **Allow notifications**. | 16 | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | 17 | ![en-us_image_0000001417062434](figures/en-us_image_0000001417062434.png) | ![en-us_image_0000001466462297](figures/en-us_image_0000001466462297.png) | ![en-us_image_0000001466782025](figures/en-us_image_0000001466782025.png) | 18 19 20## Available APIs 21 22For details about the APIs, see [@ohos.notificationManager](../reference/apis/js-apis-notificationManager.md#notificationrequestenablenotification). 23 24**Table 1** Notification APIs 25 26| Name | Description | 27| -------- | -------- | 28| isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback<boolean>): void | Checks whether notification is enabled.<br>**NOTE**<br>This is a system API and cannot be called by third-party applications. | 29| setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void | Sets whether to enable notification. Notification can be enabled or disabled in **Notifications** of the target application under **Settings** > **Apps & services** > **Apps**.<br>**NOTE**<br>This is a system API and cannot be called by third-party applications.| 30| requestEnableNotification(callback: AsyncCallback<void>): void | Requests notification to be enabled. When called for the first time, this API displays a dialog box prompting the user to enable notification. | 31 32 33## How to Develop 34 351. Import the **NotificationManager** module. 36 37 ```ts 38 import notificationManager from '@ohos.notificationManager'; 39 ``` 40 412. Call the API to request notification to be enabled. 42 43 ```ts 44 notificationManager.requestEnableNotification().then(() => { 45 console.info(`[ANS] requestEnableNotification success`); 46 }).catch((err) => { 47 console.error(`[ANS] requestEnableNotification failed, errCode[${err}]`); 48 }); 49 ``` 50