安卓(离子电容器)上的推送通知中没有声音



当我在电容器中实现插件推送通知时,我遇到了问题,问题是当手机收到推送通知时不会发出任何声音。 这是我的代码。

PushNotifications.addListener('pushNotificationReceived',
(notification: PushNotification) => {
console.log('Push received: ',JSON.stringify(notification));
}

这是 capacitor.config.json 中的设置

"PushNotifications": {
"presentationOptions": ["badge", "sound", "alert"]
}

感谢您的帮助。

向我显示创建的通知通道详细信息。
然后不要在红米手机或小米手机中进行测试。

addListenersForNotifications = async () => {
await PushNotifications.addListener('registration', 'registration Name');
await PushNotifications.addListener('registrationError', 'error');
await PushNotifications.createChannel({
id: 'fcm_default_channel',
name: 'app name',
description: 'Show the notification if the app is open on your device',
importance: 5,
visibility: 1,
lights: true,
vibration: true,
});
await PushNotifications.addListener('pushNotificationReceived', this.pushNotificationReceived);
await PushNotifications.addListener('pushNotificationActionPerformed', this.pushNotificationActionPerformed);

};

相关内容

  • 没有找到相关文章

最新更新