【发布时间】:2021-03-15 10:59:09
【问题描述】:
我在我的应用程序中使用@react-native-firebase/messaging 推送通知。 对于自定义通知声音,我使用@notifee/react-native this。
我当前的通知代码是:
import messaging from '@react-native-firebase/messaging';
import notifee from '@notifee/react-native';
await notifee.createChannel({
id: 'custom-sound',
name: 'System Sound',
sound: 'notification.mp3',
});
messaging().onMessage((remoteMessage) => {
notifee.displayNotification({
title: remoteMessage.notification.title,
body: remoteMessage.notification.body,
android: {
channelId: 'custom-sound',
},
});
});
当应用程序在屏幕上打开时,上面的代码可以正常工作,因此我的自定义通知声音可以正常工作。
但是当应用程序在后台运行时,通知声音是默认的(系统默认)
那么我如何在所有情况下设置自定义通知声音。
【问题讨论】:
-
嗨@Mithesh,有任何更新,您能否在应用程序处于后台时设置自定义声音?
-
@shreevatsa nope
-
我认为必须在触发通知的后端设置声音,并且应用程序应该打包文件
标签: react-native push-notification android-notifications firebase-notifications