Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Custom Notification Sounds using PhoneGap Build #555

Closed
neffnet opened this issue Jan 30, 2016 · 6 comments
Closed

Custom Notification Sounds using PhoneGap Build #555

neffnet opened this issue Jan 30, 2016 · 6 comments

Comments

@neffnet
Copy link

neffnet commented Jan 30, 2016

Is there any way to use a sound file for background notification from /www folder, instead of /res/raw? Alternatively, do you know a way to instruct PhoneGap Build to place files in res/raw?

Payload being sent to apns includes {sound:"beep.caf"}, and gcm payload includes {soundname:"beep"}. My problem seems to be that the sound files are not in the app's res/raw directory, they are in /www/ (i.e. /assets/www/beep.caf and /assets/www/beep.wav). Unless I'm missing something, we can't tell PhoneGap Build to put the sounds in /res/raw.

Currently, our background notifications trigger vibration-only on android and the default sound/vibration for ios.

We have a custom sound notification we trigger on foreground notifications, using the PhoneGap media plugin. How can we use the same sound for background notifications when the app is built with PhoneGap Build?

Notifications with default system sounds are working great, thanks for your efforts on this.

@macdonst
Copy link
Member

@neffnet you want to follow what @wildabeast mentions over here:

phonegap/build#401 (comment)

I really need to document that and also, please go vote up this issue:

phonegap/build#472

as it really should get added to Cordova proper.

@macdonst macdonst added this to the Release 1.6.0 milestone Jan 31, 2016
@neffnet
Copy link
Author

neffnet commented Feb 1, 2016

Thank you! My Google skills were not up to the task, but this is exactly what I was looking for.
Referenced solution worked right away for Android: I created a /locales/android/raw/beep.wav, and in the APK generated by Phonegap Build I find a /res/raw/beep.wav which plays for a background notification.

Unfortunately the solution didn't help for ios. Still uncertain how to package sound files in pgBuild for ios background notifications. I'll update here if I figure it out.

@macdonst
Copy link
Member

macdonst commented Feb 2, 2016

@neffnet Yeah, as far as I know there is no way to do it for iOS.

Please go vote up this discussion thread: apache/cordova-discuss#6

@macdonst macdonst removed this from the Release 1.6.0 milestone Feb 3, 2016
@skyprimer
Copy link

Does adding custom sound for Phonegap Build still not working?

@macdonst
Copy link
Member

@skyprimer you can now use the resource-file tag to copy custom files into your app.

http://cordova.apache.org/docs/en/latest/config_ref/index.html#resource-file

@lock
Copy link

lock bot commented Jun 3, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants