How can I use custom sounds for react native local notifications?

832 Views Asked by At

guys, I am trying to build an alarm app in React-Native where I can set custom sound for my alarm each time I set, that is sound from the device. Most of the options I found out was to use react native push notifications and alarm notifications npm libraries. They do allow using custom sounds but each time we need to dump those files in res/raw of the App folder. Can those node_modules be customised for my use case?

1

There are 1 best solutions below

1
On

you must add channelid at your project first. I use expo-notifications to create channelid by Notifications.setNotificationChannelAsync(). Notifications.setNotificationChannelAsync('emails', { name: 'E-mail notifications', importance: Notifications.AndroidImportance.HIGH, sound: 'nioce.mp3', channelId: 'emails' });like this and then when you post notification you just add channelid in your data. (I will take a pic for example but I use firebase for post notification)postman raw data example