成都有哪些网站建设的公司,什么是网络营销媒体,怎么做网络推广最有效,建设银行官方网站购房贷款利率通知是手机系统中很重要的信息展示方式#xff0c;通知不仅可以展示文字#xff0c;也可以展示图片#xff0c;甚至可以将组件加到通知中#xff0c;只要用户不清空#xff0c;通知的信息可以永久保留在状态栏上通知的介绍 通知 Notification通知#xff0c;即在一个应用…通知是手机系统中很重要的信息展示方式通知不仅可以展示文字也可以展示图片甚至可以将组件加到通知中只要用户不清空通知的信息可以永久保留在状态栏上通知的介绍 通知 Notification 通知即在一个应用的UI界面之外显示的消息主要是用来提醒用户有来自该应用中的消息。 当应用向系统发出通知时它将先以图标的形式显示在通知栏中用户可以下拉通知栏查看详细信息。 常见的使用场景 1、显示推送的短消息、即时消息等 2、显示应用的推送消息如广告、版本信息等 3、显示当前正在进行的事件如播放音乐、导航、下载等通知的使用 1、需要先定义需要发送通知的NotificationRequest// 描述通知的请求
let notificationRequest: notificationManager.NotificationRequest {//id为通知的唯一标识用于通讯的通知与取消//如果没有指定id或者id相同后发送的通知会将先发送的通知覆盖掉id: 100,content: {//notificationContentType定义通知的类型如普通文本、长文本等notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,//normal定义普通文本类型通知的内容normal: {//title定义通知内容标题title: 通知内容标题,//title定义通知内容详情text: 通知内容详情,//附加文本additionalText:通知附加文本}},//角标不点击的情况下会叠加的每次叠加“1”badgeNumber:1,
}2、调用notificationManager.publish(notificationRequest)方法发布通知// 发送通知
notificationManager.publish(notificationRequest).then((){console.info(publish success)
}).catch((err: Error) {console.error(publish failed,message is ${err});
});基本文本通知
//基础文本通知
import { notificationManager } from kit.NotificationKit;
// 描述通知的请求
let notificationRequest: notificationManager.NotificationRequest {//id为通知的唯一标识用于通讯的通知与取消id: 100,content: {//notificationContentType定义通知的类型notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,//normal定义普通文本类型通知的内容normal: {//title定义通知内容标题title: 通知内容标题,//title定义通知内容详情text: 通知内容详情}}
}
// 发送通知
notificationManager.publish(notificationRequest).then((){console.info(publish success)
}).catch((err: Error) {console.error(publish failed,message is ${err});
});