I’m using LocalNotification plugin to fire local notifications.
I need to fire three different types of notification :
- Plays a simple bip
- Plays a sound
- And just vibrates (without sound)
For this, I created three channels and I schedule each notification on its channel like this :
await LocalNotifications.createChannel({
id: "beep_channel",
name: "Beep Channel",
description: "Channel for beep notifications",
importance: 5,
visibility: 1,
sound: "beep.mp3",
vibration: true,
lights: true,
lightColor: "FF0000"
});
Also in my capacitor config file, I defined the default sound (wich is played for the second notification).
plugins: {
"LocalNotifications": {
"smallIcon": "ic_stat_icon_config_sample",
"iconColor": "#18b018",
"sound": "default_sound.mp3",
}
}
here is how I’m scheduling notification (bip) :
LocalNotifications
.schedule({
notifications: [
{
title: Notification with bip',
body: 'Bip body text',
id: 100,
schedule: {at: new Date(Date.now() + 1000 * 20)},
sound: "bip.mp3",
channelId: "bip_channel",
extra: {
ts: moment().toDate()
}
}
]
})
The issue that I have : all my notifications play the default sound, even if I put a different sound in sound property of the notification.
Thanks for the help.