1# Common Event and Notification Subsystem ChangeLog 2 3## cl.notification.1 API Exception Handling Method Changes 4 5Certain event notification APIs use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. 6 7**Change Impacts** 8 9The application developed based on earlier versions needs to adapt the new APIs and their method for returning API error information. Otherwise, the original service logic will be affected. 10 11**Key API/Component Changes** 12 13For adaptation to the unified API exception handling mode, certain event notification APIs are deprecated (original APIs in the following table) and corresponding new APIs in the following table are added. The newly added APIs support unified error code handling specifications and function the same as the original APIs. 14 15| Original API | New API | 16| ----------------------- | -------------------------------- | 17| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts | 18| @ohos.notification.d.ts | @ohos.notificationManager.d.ts | 19| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts | 20 21**Adaptation Guide** 22 23The original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem. 24 25If the original API uses **@ohos.commonEvent**: 26 27```js 28import commonEvent from '@ohos.commonEvent'; 29``` 30 31You can directly modify **import** to switch to the new namespace: 32 33```js 34import commonEvent from '@ohos.commonEventManager'; 35``` 36 37**@ohos.notification** is split into two namespaces. You need to select a new namespace for adaptation. 38 39In addition, exception handling is needed. For details, see the API reference for the new APIs. 40 41## cl.notification.2 API Changes 42 43The names of some event notification APIs are changed. 44 45**Key API/Component Changes** 46 47| Module | Class | Method/Attribute/Enumeration/Constant | Change Type| 48| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | 49| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | 50| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean): Promise<**void**>; | Deprecated | 51| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | 52| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean): Promise<**void**>; | Added | 53| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | 54| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | Deprecated | 55| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | 56| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | Added | 57| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | 58| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | 59| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | 60| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean): Promise<**void**>; | Added | 61| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | 62| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | Deprecated | 63| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | 64| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | Added | 65