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?
Asked
Active
Viewed 616 times
0

Sriharsha K
- 303
- 1
- 6
- 18
1 Answers
1
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

Kamonthat Ruangs
- 11
- 2
-
just add sound files at %projectname%/android/app/src/main/res/raw if raw folder aren't at this directory just create it and add sounds to it. – Kamonthat Ruangs Jan 21 '21 at 05:36