-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Play a custom sound for notification #37
Comments
The Notification sound should either be a constant value (default system notification sound == 1), or a URI. In your case, that would probably translate to Haven't tried this but pretty certain it should work. |
I tried using the URI as @zakelfassi instructed but I still didn't hear the custom sound. This is the usage
I also tried without the file extension also. Below is the file structure: I also checked the code and I actually didn't find any code that would play the custom sound file. Specifically, I checked the file Could someone please confirm if that is the case that the custom sound files are not supported? I checked the android documentation and it seems that I need to call the |
The line Do you still hear the default sound or nothing at all now? (I think after adding files to raw/ you should rerun |
@zakelfassi I didn't hear any sound at all. I added the following lines of code in the Notification.java class
After this, I was able to hear the custom sound as expected. The sound file URI shouldn't contain the extension or else the sound doesn't play. I am not sure if this is all that one needs to play the custom sound or we need to handle any special cases here as well. I am just starting up with mobile development. For e.g. I don't know if the |
I want to play a custom sound for a local notification. What do I need to put in the
sound
field? I tried the following:where
alarm_1.m4a
is an audio file that is present at<PROJECT-DIR>/android/app/src/main/res/raw/alarm_1.m4a
but it still plays the default notification sound.The text was updated successfully, but these errors were encountered: