phonegap/phonegap-plugin-push

Custom sound: I found it. It's a **serious** bug in the plugin. I worked around it and now have custom sounds back to working.

Opened this issue · 3 comments

I don't think this issue can be closed, I have the same problem... @ppetree could you please share your fix?

Originally posted by @ppetree in #2671 (comment)

Check the size of your sound file. While iOS imposes a limit of 30 seconds, nothing is said about the file size itself. In fact, mine worked just fine until I upgraded and it stopped working. It would still play default sounds just fine but NOT my custom sound files. Once I changed the file format and got them down to a smaller size they worked fine.

In the past I've suggested an enhancement to this plugin that would be a "diagnostic mode" in which we could call the plugin and it would either play the file and return "success" or if it failed it would tell us why. I'm not sure this suggestion even made the roadmap.

Hello

@fabiobeoni What changes did you have to make to make custom audio work?

@ppetree How big should the audio file be?

I've made it, I have custom sounds

##how i did it

The first thing I did was follow the audio recommendation of @ppetree

Leave it at 16 bits, the conversion will be done on this website
https://audio.online-convert.com/en/convertir-a-wav
Follow the instructions on the page

despues cree mis canales, 1 de ronda y 1 de mensaje

`

this.push.createChannel({
  id: "YourChannel",
  description: "Your descrition channel",
  importance: 5,
  vibration: true,
  sound: 'Your Custom Sound',
  visibility: 1
  // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
}).then(() => console.log('your YourChannel create'));`

my sound file I left it on assets/sound/mysound.wav

to leave the file in res/raw use the following line in my config.xml
<resource-file src="src/assets/sound/siren.wav" target="app/src/main/res/raw/siren.wav" />

I finally removed my app from my smartphone and reinstalled

my playload is
{ "to": "You Token", "data": { "title":"Notification Tittle", "body":"Some text", "android_channel_id":"Your Channel ", } }

Hope it helps you

regards