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

通知消息

说明:

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

导入模块

import notification from '@system.notification';

ActionResult

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

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

ShowNotificationOptions

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

名称可读可写类型必填描述
contentTitlestring通知标题。
contentTextstring通知内容。
clickActionActionResult通知被点击后触发的行为。

notification.show

show(options?: ShowNotificationOptions): void

显示通知。

系统能力: SystemCapability.Notification.Notification

参数:

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

示例:

export default {    
  show() {        
    notification.show({            
      contentTitle: 'title info',            
        contentText: 'text',            
        clickAction: {                
          bundleName: 'com.example.testapp',                
          abilityName: 'notificationDemo',                
          uri: '/path/to/notification',            
         },
     });    
  },
}
;
  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值