HarmonyOS 鸿蒙Next收到消息通知栏没弹出,但手机顶部下拉有消息通知

分类: 365bet现金网 时间: 2025-11-11 21:04:38 作者: admin 阅读: 4916
HarmonyOS 鸿蒙Next收到消息通知栏没弹出,但手机顶部下拉有消息通知

不同类型的通知渠道对应的通知提醒方式不同,这里的notificationQequest需要加个SlotType字段为SOCIAL_COMMUNICATION,来设置通知渠道。 参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/notification-slot-0000001774120666#ZH-CN_TOPIC_0000001857877345__%E9%80%9A%E7%9F%A5%E6%B8%A0%E9%81%93%E7%B1%BB%E5%9E%8B%E8%AF%B4%E6%98%8E

```

let notificationQequest: notificationManager.NotificationRequest = {

id: 1,

notificationSlotType: notificationManager.SlotType.SOCIAL_COMMUNICATION,

content: {

notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 普通文本类型通知

normal: {

title: 'test_title',

text: 'test_text',

additionalText: 'test_additionalText',

}

}

};

```

相关推荐