提交 eb7c8a05 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

update: 创建通知时,增加通知权限的判断。

上级 0252135c
......@@ -32,26 +32,33 @@
const manager = uni.getChannelManager()
console.log("channels : " + manager.getAllChannels());
},
handleCreateLocalNotification() {
uni.createPushMessage({
title: "halo",
content: "world",
// cover:true,
channelId: this.isXM ? "112735" : "msg-pass",
when: Date.now() + 10000,
icon: "/static/logo.jpg",
// delay:5,
payload: {
pkey: "pvalue1"
},
category: "IM",
success(res) {
console.log("res: " + res);
},
fail(e) {
console.log("fail :" + e);
}
})
handleCreateLocalNotification() {
if(uni.getAppAuthorizeSetting().notificationAuthorized == "authorized"){
uni.createPushMessage({
title: "halo",
content: "world",
// cover:true,
channelId: this.isXM ? "112735" : "msg-pass",
when: Date.now() + 10000,
icon: "/static/logo.jpg",
// delay:5,
payload: {
pkey: "pvalue1"
},
category: "IM",
success(res) {
console.log("res: " + res);
},
fail(e) {
console.log("fail :" + e);
}
})
}else{
uni.showToast({
title:"请在设置中开启通知权限",
icon:"error"
})
}
},
handleGetClientId() {
uni.getPushClientId({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册