# @ohos.notificationSubscribe (NotificationSubscribe模块) 本模块提供通知订阅、取消订阅、通知移除等,一般情况下,只有系统应用具有这些操作权限。 > **说明:** > > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 ```ts import notificationSubscribe from '@ohos.notificationSubscribe'; ``` ## NotificationSubscribe.subscribe subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\): void 订阅通知并指定订阅信息(callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------- | ---- | ---------------- | | subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | 是 | 通知订阅信息。 | | callback | AsyncCallback\ | 是 | 订阅动作回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600012 | No memory space. | **示例:** ```ts import Base from '@ohos.base'; //subscribe回调 let subscribeCallback = (err: Base.BusinessError) => { if (err) { console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribe success"); } } let onConsumeCallback = (data: notificationSubscribe.SubscribeCallbackData) => { console.info("Consume callback: " + JSON.stringify(data)); } let subscriber: notificationSubscribe.NotificationSubscriber = { onConsume: onConsumeCallback }; let info: notificationSubscribe.NotificationSubscribeInfo = { bundleNames: ["bundleName1","bundleName2"] }; notificationSubscribe.subscribe(subscriber, info, subscribeCallback); ``` ## NotificationSubscribe.subscribe subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): void 订阅当前用户下所有应用的通知(callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | ---------------- | | subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | callback | AsyncCallback\ | 是 | 订阅动作回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600012 | No memory space. | **示例:** ```ts import Base from '@ohos.base'; let subscribeCallback = (err: Base.BusinessError) => { if (err) { console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribe success"); } } let onConsumeCallback = (data: notificationSubscribe.SubscribeCallbackData) => { console.info("Consume callback: " + JSON.stringify(data)); } let subscriber: notificationSubscribe.NotificationSubscriber = { onConsume: onConsumeCallback }; notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ## NotificationSubscribe.subscribe subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\ 订阅通知并指定订阅信息(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------- | ---- | ------------ | | subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | 否 | 通知订阅信息,默认为空。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600012 | No memory space. | **示例:** ```ts import Base from '@ohos.base'; let onConsumeCallback = (data: notificationSubscribe.SubscribeCallbackData) => { console.info("Consume callback: " + JSON.stringify(data)); } let subscriber: notificationSubscribe.NotificationSubscriber = { onConsume: onConsumeCallback }; notificationSubscribe.subscribe(subscriber).then(() => { console.info("subscribe success"); }).catch((err: Base.BusinessError) => { console.error("subscribe fail: " + JSON.stringify(err)); }); ``` ## NotificationSubscribe.unsubscribe unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): void 取消订阅(callbcak形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | -------------------- | | subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | callback | AsyncCallback\ | 是 | 取消订阅动作回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | **示例:** ```ts import Base from '@ohos.base'; let unsubscribeCallback = (err: Base.BusinessError) => { if (err) { console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("unsubscribe success"); } } let onDisconnectCallback = () => { console.info("subscribe disconnect"); } let subscriber: notificationSubscribe.NotificationSubscriber = { onDisconnect: onDisconnectCallback }; notificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); ``` ## NotificationSubscribe.unsubscribe unsubscribe(subscriber: NotificationSubscriber): Promise\ 取消订阅(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | ------------ | | subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | **示例:** ```ts import Base from '@ohos.base'; let onDisconnectCallback = () => { console.info("subscribe disconnect"); } let subscriber: notificationSubscribe.NotificationSubscriber = { onDisconnect: onDisconnectCallback }; notificationSubscribe.unsubscribe(subscriber).then(() => { console.info("unsubscribe success"); }).catch((err: Base.BusinessError) => { console.error("unsubscribe fail: " + JSON.stringify(err)); }); ``` ## NotificationSubscribe.remove remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\): void 删除指定通知(Callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------------- | ----------------------------------| ---- | -------------------- | | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600007 | The notification is not exist. | | 17700001 | The specified bundle name was not found. | **示例:** ```ts import Base from '@ohos.base'; import NotificationManager from '@ohos.notificationManager'; let removeCallback = (err: Base.BusinessError) => { if (err) { console.error(`remove failed, code is ${err.code}, message is ${err.message}`); } else { console.info("remove success"); } } let bundle: NotificationManager.BundleOption = { bundle: "bundleName1", }; let notificationKey: notificationSubscribe.NotificationKey = { id: 0, label: "label", }; let reason: notificationSubscribe.RemoveReason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; notificationSubscribe.remove(bundle, notificationKey, reason, removeCallback); ``` ## NotificationSubscribe.remove remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\ 删除指定通知(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------------- | --------------- | ---- | ---------- | | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600007 | The notification is not exist. | | 17700001 | The specified bundle name was not found. | **示例:** ```ts import Base from '@ohos.base'; import NotificationManager from '@ohos.notificationManager'; let bundle: NotificationManager.BundleOption = { bundle: "bundleName1", }; let notificationKey: notificationSubscribe.NotificationKey = { id: 0, label: "label", }; let reason: notificationSubscribe.RemoveReason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; notificationSubscribe.remove(bundle, notificationKey, reason).then(() => { console.info("remove success"); }).catch((err: Base.BusinessError) => { console.error("remove fail: " + JSON.stringify(err)); }); ``` ## NotificationSubscribe.remove remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): void 删除指定通知(Callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | | hashCode | string | 是 | 通知唯一ID。可以通过[onConsume](js-apis-inner-notification-notificationSubscriber.md#onConsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象中的hashCode。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600007 | The notification is not exist. | **示例:** ```ts import Base from '@ohos.base'; let hashCode: string = 'hashCode'; let removeCallback = (err: Base.BusinessError) => { if (err) { console.error(`remove failed, code is ${err.code}, message is ${err.message}`); } else { console.info("remove success"); } } let reason: notificationSubscribe.RemoveReason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; notificationSubscribe.remove(hashCode, reason, removeCallback); ``` ## NotificationSubscribe.remove remove(hashCode: string, reason: RemoveReason): Promise\ 删除指定通知(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------- | ---- | ---------- | | hashCode | string | 是 | 通知唯一ID。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600007 | The notification is not exist. | **示例:** ```ts import Base from '@ohos.base'; let hashCode: string = 'hashCode'; let reason: notificationSubscribe.RemoveReason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; notificationSubscribe.remove(hashCode, reason).then(() => { console.info("remove success"); }).catch((err: Base.BusinessError) => { console.error("remove fail: " + JSON.stringify(err)); }); ``` ## NotificationSubscribe.remove10+ remove(hashCodes: Array\, reason: RemoveReason, callback: AsyncCallback\): void 批量删除指定通知(Callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | |-----------|-------------------------------| ---- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | hashCodes | Array\ | 是 | 通知唯一ID数组集合。可以通过[onConsume](js-apis-inner-notification-notificationSubscriber.md#onConsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象中的hashCode。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | **示例:** ```ts import Base from '@ohos.base'; let hashCodes: string[] = ['hashCode1', 'hashCode2']; let removeCallback = (err: Base.BusinessError) => { if (err) { console.error(`remove failed, code is ${err.code}, message is ${err.message}`); } else { console.info("remove success"); } } let reason: notificationSubscribe.RemoveReason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; notificationSubscribe.remove(hashCodes, reason, removeCallback); ``` ## NotificationSubscribe.remove10+ remove(hashCodes: Array\, reason: RemoveReason): Promise\ 批量删除指定通知(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | |-----------|-------------------------------| ---- |-------------| | hashCodes | Array\ | 是 | 通知唯一ID数组集合。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | **示例:** ```ts import Base from '@ohos.base'; let hashCodes: string[] = ['hashCode1','hashCode2']; let reason: notificationSubscribe.RemoveReason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; notificationSubscribe.remove(hashCodes, reason).then(() => { console.info("remove success"); }).catch((err: Base.BusinessError) => { console.error("remove fail: " + JSON.stringify(err)); }); ``` ## NotificationSubscribe.removeAll removeAll(bundle: BundleOption, callback: AsyncCallback\): void 删除指定应用的所有通知(Callback形式)。 **系统能力**:SystemCapability.Notification.Notification **系统API**:此接口为系统接口,三方应用不支持调用。 **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ---------------------------- | | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 删除指定应用的所有通知回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 17700001 | The specified bundle name was not found. | **示例:** ```ts import Base from '@ohos.base'; let removeAllCallback = (err: Base.BusinessError) => { if (err) { console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } } let bundle: notificationSubscribe.BundleOption = { bundle: "bundleName1", }; notificationSubscribe.removeAll(bundle, removeAllCallback); ``` ## NotificationSubscribe.removeAll removeAll(callback: AsyncCallback\): void 删除所有通知(Callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | | callback | AsyncCallback\ | 是 | 删除所有通知回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | **示例:** ```ts import Base from '@ohos.base'; let removeAllCallback = (err: Base.BusinessError) => { if (err) { console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } } notificationSubscribe.removeAll(removeAllCallback); ``` ## NotificationSubscribe.removeAll removeAll(bundle?: BundleOption): Promise\ 删除指定应用的所有通知(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | | bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 否 | 指定应用的包信息。默认为空,表示删除所有通知。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 17700001 | The specified bundle name was not found. | **示例:** ```ts import Base from '@ohos.base'; // 不指定应用时,删除所有通知 notificationSubscribe.removeAll().then(() => { console.info("removeAll success"); }).catch((err: Base.BusinessError) => { console.error("removeAll fail: " + JSON.stringify(err)); }); ``` ## NotificationSubscribe.removeAll removeAll(userId: number, callback: AsyncCallback\): void 删除指定用户下的所有通知(callback形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | | userId | number | 是 | 用户ID。 | | callback | AsyncCallback\ | 是 | 删除指定用户所有通知回调函数。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600008 | The user is not exist. | **示例:** ```ts import Base from '@ohos.base'; let removeAllCallback = (err: Base.BusinessError) => { if (err) { console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } } let userId: number = 1; notificationSubscribe.removeAll(userId, removeAllCallback); ``` ## NotificationSubscribe.removeAll removeAll(userId: number): Promise\ 删除指定用户下的所有通知(Promise形式)。 **系统能力**:SystemCapability.Notification.Notification **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER **系统API**: 此接口为系统接口,三方应用不支持调用。 **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | | userId | number | 是 | 用户ID。 | **错误码:** 错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600008 | The user is not exist. | **示例:** ```ts import Base from '@ohos.base'; let removeAllCallback = (err: Base.BusinessError) => { if (err) { console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } } let userId: number = 1; notificationSubscribe.removeAll(userId, removeAllCallback); ``` ## NotificationKey **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统API**: 此接口为系统接口,三方应用不支持调用。 | 名称 | 类型 | 必填 | 说明 | | ----- | ------ | --- | -------- | | id | number | 是 | 通知ID。 | | label | string | 否 | 通知标签,默认为空。 | ## RemoveReason **系统能力**:SystemCapability.Notification.Notification **系统API**: 此接口为系统接口,三方应用不支持调用。 | 名称 | 值 | 说明 | | -------------------- | --- | -------------------- | | CLICK_REASON_REMOVE | 1 | 点击通知后删除通知。 | | CANCEL_REASON_REMOVE | 2 | 用户删除通知。 |