HarmonyOS 鸿蒙Next Notification Kit本地通知推送请求权限失败
HarmonyOS 鸿蒙Next Notification Kit本地通知推送请求权限失败
Notification Kit本地通知推送请求权限失败
报错 E ┌───────[ANS] requestEnableNotification failed, code is 401, message is Invalid parameter──
弹框请求权限已经点击允许了
notificationManager.isNotificationEnabled().then((data: boolean) => {
log.i(TAG,"isNotificationEnabled success, data: " + JSON.stringify(data));
if(!data){
notificationManager.requestEnableNotification().then((value) => {
log.i(TAG,`[ANS] requestEnableNotification success`);
this.addNotification()
}).catch((err : Base.BusinessError) => {
if(1600004 == err.code){
log.i(TAG,`[ANS] requestEnableNotification refused`);
} else {
log.e(TAG,`[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
}
});
}
}).catch((err : Base.BusinessError) => {
log.e(TAG,`isNotificationEnabled fail: ${JSON.stringify(err)}`);
});
更多关于HarmonyOS 鸿蒙Next Notification Kit本地通知推送请求权限失败的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
normal?: NotificationBasicContent;
notificationBasicContent 要求 title ,text 必须有值;
更多关于HarmonyOS 鸿蒙Next Notification Kit本地通知推送请求权限失败的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html