我已经配置了远程通知,并且一切都按照预期工作。现在我想为我的远程通知设置自定义的声音。我尝试了很多方法,但都没有成功。
我正在使用react-native-push-notification和react-native-firebase。
我将自定义声音文件放置在android/app/src/main/res/raw/sound.mp3
。
我还尝试了soundName:"sound.mp3"
,但未能成功。
感谢任何有关此事的帮助。谢谢 :)下面是示例代码:
PushNotification.configure({
onRegister: async function(token) {
},
onNotification: function(notification) {
console.log(notification);
},
senderID: 'xxxx',
permissions: {
alert: true,
badge: true,
sound: true,
},
playSound: true,
soundName: 'sound.mp3',
popInitialNotification: true,
requestPermissions: true,
});
}````