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