1e41f4b71Sopenharmony_ci# Notification Subsystem ChangeLog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.notificationManager.1 Request Notification Enabling API Deprecated 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci**Access Level** 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciPublic API 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci**Reason for Change** 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 1. If malicious applications call pop-up windows in the background, security risks may exist. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 2. When this API is used to call a pop-up window, this window cannot follow the application window, resulting in poor UX. 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci**Change Impact** 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ciThis API is deprecated in the **notificationManager** module. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**Start API Level** 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci9 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci**Change Since** 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ciOpenHarmony SDK 5.0.0.31 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci**Deprecated APIs/Components** 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci|Original API|New API| 30e41f4b71Sopenharmony_ci|-------|-------| 31e41f4b71Sopenharmony_ci|requestEnableNotification(callback: AsyncCallback\<void\>): void|requestEnableNotification(context: UIAbilityContext, callback: AsyncCallback\<void\>): void| 32e41f4b71Sopenharmony_ci|requestEnableNotification(): Promise\<void\>|requestEnableNotification(context: UIAbilityContext): Promise\<void\>| 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci**Adaptation Guide** 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ciUse the new API **requestEnableNotification**, which has an input parameter **context**. 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ciCode example before deprecation: 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci```ts 42e41f4b71Sopenharmony_ciimport { notificationManager } from '@kit.NotificationKit'; 43e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci// Request notification pop-up window is unable to follow the application window. 46e41f4b71Sopenharmony_cinotificationManager.requestEnableNotification().then(() => { 47e41f4b71Sopenharmony_ci console.info("requestEnableNotification success"); 48e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 49e41f4b71Sopenharmony_ci console.error(`requestEnableNotification fail: ${JSON.stringify(err)}`); 50e41f4b71Sopenharmony_ci}); 51e41f4b71Sopenharmony_ci``` 52e41f4b71Sopenharmony_ciCode example after deprecation: 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci```ts 55e41f4b71Sopenharmony_ciimport { notificationManager } from '@kit.NotificationKit'; 56e41f4b71Sopenharmony_ciimport { hilog } from '@kit.PerformanceAnalysisKit'; 57e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit'; 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_cilet context = getContext(this) as common.UIAbilityContext; 60e41f4b71Sopenharmony_ci// Request notification pop-up window passes in the UIAbilityContext parameter, enabling the pop-up window to follow the application window. 61e41f4b71Sopenharmony_cinotificationManager.requestEnableNotification(context).then(() => { 62e41f4b71Sopenharmony_ci console.info("requestEnableNotification success"); 63e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 64e41f4b71Sopenharmony_ci console.error(`requestEnableNotification fail: ${JSON.stringify(err)}`); 65e41f4b71Sopenharmony_ci}); 66e41f4b71Sopenharmony_ci``` 67