1e41f4b71Sopenharmony_ci# @system.notification (通知消息) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci> **说明:** 4e41f4b71Sopenharmony_ci> - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.notification`](js-apis-notification.md)。 5e41f4b71Sopenharmony_ci> 6e41f4b71Sopenharmony_ci> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## 导入模块 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci```ts 13e41f4b71Sopenharmony_ciimport notification from '@system.notification'; 14e41f4b71Sopenharmony_ci``` 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci## ActionResult 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci| 名称 | 类型 | 必填 | 说明 | 21e41f4b71Sopenharmony_ci| ----------- | ---------------------------------------------- | ---- | ------------------------- | 22e41f4b71Sopenharmony_ci| bundleName | string | 是 | 单击通知后要重定向到的应用程序的Bundle名。 | 23e41f4b71Sopenharmony_ci| abilityName | string | 是 | 单击通知后要重定向到的应用程序的Ability名称。 | 24e41f4b71Sopenharmony_ci| uri | string | 否 | 要重定向到的页面的uri。 | 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci## ShowNotificationOptions 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci| 名称 | 类型 | 必填 | 说明 | 32e41f4b71Sopenharmony_ci| ------------- | ---------------------------------------------- | ---- | ------------------------- | 33e41f4b71Sopenharmony_ci| contentTitle | string | 否 | 通知标题。 | 34e41f4b71Sopenharmony_ci| contentText | string | 否 | 通知内容。 | 35e41f4b71Sopenharmony_ci| clickAction | ActionResult | 否 | 通知被点击后触发的行为。 | 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci## notification.show 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_cishow(options?: ShowNotificationOptions): void 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci显示通知。 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.Notification.Notification 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci**参数:** 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 49e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 50e41f4b71Sopenharmony_ci| options | ShowNotificationOptions | 否 | 通知标题。 | 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci**示例:** 53e41f4b71Sopenharmony_ci```ts 54e41f4b71Sopenharmony_cilet notificationObj: notification = { 55e41f4b71Sopenharmony_ci show() { 56e41f4b71Sopenharmony_ci notification.show({ 57e41f4b71Sopenharmony_ci contentTitle: 'title info', 58e41f4b71Sopenharmony_ci contentText: 'text', 59e41f4b71Sopenharmony_ci clickAction: { 60e41f4b71Sopenharmony_ci bundleName: 'com.example.testapp', 61e41f4b71Sopenharmony_ci abilityName: 'notificationDemo', 62e41f4b71Sopenharmony_ci uri: '/path/to/notification' 63e41f4b71Sopenharmony_ci } 64e41f4b71Sopenharmony_ci }); 65e41f4b71Sopenharmony_ci } 66e41f4b71Sopenharmony_ci} 67e41f4b71Sopenharmony_ci```