当前位置: 首页 > news >正文

HarmonyOS NEXT应用开发-Notification Kit(用户通知服务)notificationManager.addSlot

1.notificationManager.addSlot
支持设备Phone2in1TabletCarWearable
addSlot(type: SlotType, callback: AsyncCallback<void>): void
创建指定类型的通知渠道。使用callback异步回调。
系统能力:SystemCapability.Notification.Notification
 

HarmonyOS NEXT应用开发-Notification Kit(用户通知服务)notificationManager.addSlot-鸿蒙开发者社区


 

HarmonyOS NEXT应用开发-Notification Kit(用户通知服务)notificationManager.addSlot-鸿蒙开发者社区


示例:

import { BusinessError } from '@kit.BasicServicesKit';// addslot回调
let addSlotCallBack = (err: BusinessError): void => {if (err) {console.error(`Failed to add slot. Code is ${err.code}, message is ${err.message}`);} else {console.info(`Succeeded in adding slot.`);}
}
notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack);

    2.notificationManager.addSlot
    支持设备Phone2in1TabletCarWearable
    addSlot(type: SlotType): Promise<void>
    创建指定类型的通知渠道。使用Promise异步回调。
    系统能力:SystemCapability.Notification.Notification
     

    HarmonyOS NEXT应用开发-Notification Kit(用户通知服务)notificationManager.addSlot-鸿蒙开发者社区

    HarmonyOS NEXT应用开发-Notification Kit(用户通知服务)notificationManager.addSlot-鸿蒙开发者社区


    示例:

    import { BusinessError } from '@kit.BasicServicesKit';notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION).then(() => {console.info(`Succeeded in adding slot.`);
    }).catch((err: BusinessError) => {console.error(`Failed to add slot. Code is ${err.code}, message is ${err.message}`);
    });

      本文主要参考引用自HarmonyOS官方网站

      http://www.xdnf.cn/news/142687.html

      相关文章:

    • POI从入门到上手(一)-轻松完成Apache POI使用,完成Excel导入导出.
    • 【滑动窗口+哈希表/数组记录】Leetcode 438. 找到字符串中所有字母异位词
    • 《100天精通Python——基础篇 2025 第3天:变量与数据类型全面解析,掌握Python核心语法》
    • 基于大模型对先天性巨结肠全流程预测及医疗方案研究报告
    • ​升级Ubuntu 20.04 LTS到22.04 LTS​
    • Python 教程:我们可以给 Python 文件起中文名吗?
    • EDI 如何与 ERP,CRM,WMS等系统集成
    • 各类前端开发的框架比较及其核心特性、开发体验、生态系统以及在不同项目中的适用性
    • AUTOSAR图解==>AUTOSAR_SWS_SAEJ1939TransportLayer
    • 每日c/c++题 备战蓝桥杯(P1049 [NOIP 2001 普及组] 装箱问题)
    • PostgreSQL 漏洞信息详解
    • DAX Studio将PowerBI与EXCEL连接
    • 【遥感图像分类】【综述】遥感影像分类:全面综述与应用
    • 广州 3D 展厅开启企业展示新时代​
    • SecMulti-RAG:兼顾数据安全与智能检索的多源RAG框架,为企业构建不泄密的智能搜索引擎
    • python如何取消word中的缩进
    • 深入解析 SMB 相关命令:smbmap、smbclient、netexec 等工具的使用指南
    • 如何在Linux用libevent写一个聊天服务器
    • 基于多技术栈的数学问题求解系统设计与实现
    • Winform(1.Winform控件学习)
    • Java—数 组
    • Unity 打包后 无阴影 阴影不显示
    • 通过音频的pcm数据格式利用canvas绘制音频波形图
    • 设计模式-- 原型模式详解
    • 为什么栈内存比堆内存速度快?
    • WEB漏洞-XSS跨站原理分类
    • CNN卷积神经网络知识点回顾学习(一)
    • Python爬虫实战:获取网yi新闻网财经信息并做数据分析,以供选股做参考
    • 【DC】buffer详解
    • Flink 数据清洗与字段标准化最佳实践