鸿蒙语言基础类库:【@system.notification (通知消息)】

通知消息

说明:

  • 从API Version 7 开始,该接口不再维护,推荐使用新接口[@ohos.notification]。
  • 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import notification from '@system.notification';

ActionResult

系统能力:以下各项对应的系统能力均为SystemCapability.Notification.Notification

名称 可读 可写 类型 必填 描述
bundleName string 单击通知后要重定向到的应用程序的Bundle名。
abilityName string 单击通知后要重定向到的应用程序的Ability名称。
uri string 要重定向到的页面的uri。

ShowNotificationOptions

系统能力:以下各项对应的系统能力均为SystemCapability.Notification.Notification

名称 可读 可写 类型 必填 描述
contentTitle string 通知标题。
contentText string 通知内容。
clickAction ActionResult 通知被点击后触发的行为。

notification.show

show(options?: ShowNotificationOptions): void

显示通知。

系统能力: SystemCapability.Notification.Notification

参数:

参数名 类型 必填 说明
options ShowNotificationOptions 通知标题。HarmonyOS与OpenHarmony鸿蒙文档籽料:结尾拿

示例:

export default {    
  show() {        
    notification.show({            
      contentTitle: 'title info',            
        contentText: 'text',            
        clickAction: {                
          bundleName: 'com.example.testapp',                
          abilityName: 'notificationDemo',                
          uri: '/path/to/notification',            
         },
     });    
  },
}
;

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-18 00:08:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-18 00:08:02       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-18 00:08:02       58 阅读
  4. Python语言-面向对象

    2024-07-18 00:08:02       69 阅读

热门阅读

  1. go recover

    2024-07-18 00:08:02       23 阅读
  2. docker从0到1 部署gitlab 纯干货

    2024-07-18 00:08:02       22 阅读
  3. C# —— var

    2024-07-18 00:08:02       23 阅读
  4. 【VUE】10、VUE项目中多环境管理使用

    2024-07-18 00:08:02       24 阅读
  5. React学习记录 ---第六章

    2024-07-18 00:08:02       21 阅读
  6. python 读取 hdfs 数据

    2024-07-18 00:08:02       20 阅读
  7. 营销策划方案模板

    2024-07-18 00:08:02       22 阅读
  8. C#模式匹配 关系模式,多个输入

    2024-07-18 00:08:02       21 阅读
  9. NumPy中np.clip()的用法

    2024-07-18 00:08:02       21 阅读
  10. geojson的数据格式是什么

    2024-07-18 00:08:02       19 阅读