I have gone over the documentation over here.
https://documentation.onesignal.com/docs/customize-notification-sounds
the doc does not says anything specifically for react native , in which folder i should add the sound files. it would be helpful for everybody .
Hello,
Thank you for your question. You have to follow the respective instructions for the native version of each platform. If you are using Expo, you will need to eject first.
i have made my app using react-native-cli for android platform . can you please tell me where to i should put the sound file . thanks ? @rgomezp
Hello,
You must put it in the res/raw folder
is res/raw from the /root or from /root/android/ . i have tried both . didnt work...
@rgomezp
did you include the file extension when you put the name of the file in the dashboard? @nahidmbstu
i have added the file in .mp3 format in both folder. i did not added the file extension in dashboard. it gives me the default sound. not the custom one. @rgomezp
Please make sure you have done all of the following:
Sometimes, the build step will remove files it believes are unnecessary depending on the setup you have. Please make sure the build is not removing the file.
Cheers
Feel free to ask I reopen this issue if you are still having issues. I will also make sure to update the documentation to make sure it reflects the correct path
Edit: https://documentation.onesignal.com/docs/customize-notification-sounds#section-android-and-derivatives-like-amazon- ADDED
Hello! I have the same issue im using React Native.
I have added the mp3 (and ogg) file to android/app/src/main/res/raw, also tried on /android/app/res/raw, and setting the name on the notification template like "notificationsound" without the extension, also tried setting it from the REST API and still when the notification arrives, it plays the default sound.
Please help.
Howdy,
Please unpack the apk file and see if the sound file is being added to the correct location.
Hey guys. I was having the same problem. Not sure which one solved but I did these two things:
Make sure you have 'sound' permission enabled in the app permissions.
Hey guys. I was having the same problem. Not sure which one solved but I did these two things:
- Open project from android studio, clean, build, run.
- Removed the app and installed again.
It actually worked after I reinstalled the app.
After struggling for hours, surprisingly this is what fixed my issue.
Also, the path to store the sound file given in the documentation is wrong. The file should be stored at <project-root>\android\app\src\main\res\raw instead of <project-root>/android/app/res/raw. I suggest onesignal team to kindly update that as it will difficult for someone with non-android development background to figure the mistake.
I have Xiaomi and to allow sounds should I do it manually app info => Notification => allow sound ✅ :D after enabling it I can get the sound as expected So
@yosagar can you share this permission?
i couldn't found it :\
Most helpful comment
After struggling for hours, surprisingly this is what fixed my issue.
Also, the path to store the sound file given in the documentation is wrong. The file should be stored at
<project-root>\android\app\src\main\res\rawinstead of<project-root>/android/app/res/raw. I suggest onesignal team to kindly update that as it will difficult for someone with non-android development background to figure the mistake.