phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 996 forks source link

Notifications received while app is in background do not use custom sound (iOS) #368

Open 84pennies opened 10 years ago

84pennies commented 10 years ago

When the app is in the foreground, the custom sound plays fine.

When the app is in the background, it uses the default iOS sound.

Is this a limitation/known issue? I have scoured stack overflow and this git and have not found anything. My objective-C isn't good enough to figure it out, so I am asking for a kind soul to help : )

Thanks,

Matt

84pennies commented 10 years ago

anyone?

jvwelzen commented 10 years ago

Same question here...

Is it possible to use a custom sound when the app is not in the foreground or not running at all.

OstrichCorpse commented 10 years ago

Hi, have the similar issue, but there's no sound at all when the app is in the background. Can you show me how are you registering for a push notifications?

The default iOS notification sound would work fine for me.

jvwelzen commented 10 years ago

sound : true

Maybe ??? :-)

84pennies commented 9 years ago

@OstrichCorpse I am not doing anything differently than the readme instructs. I would take a look at how you are formatting your json payload as that can be a bit tricky coming from the server getting it right.

Any word from the devs about this being a future feature or are we stuck using the stock push notification tone?

sreedeviIOS commented 9 years ago

Hi....am also facing this issue.i set a custom sound for the push notification and when the app is in foreground the push notification is appearing with the custom sound. But when it is in background state push notification appears silently .I am working in iOS 8. If you people have any idea , please help me .

Thanks in advance

jvwelzen commented 9 years ago

I think the problem lays with the Location of the sound file.

If you want to play it in the background you must use www/sound.wav but in the foreground you only use sound.wav

bostondv commented 9 years ago

I was able to get a custom sound file to play on iOS 8 in background by doing the following:

Example sending using Node APN:

var message = new apn.Notification();
message.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.
message.badge = 1;
message.alert = 'Test';
message.sound = 'beep.wav';
apnConnection.pushNotification(message, recipients);
quedicesebas commented 9 years ago

I have this issue in Android, any clue?

bostondv commented 9 years ago

Check out https://github.com/phonegap-build/PushPlugin/pull/301

mategvo commented 8 years ago

For ios you need to 1.include the sound name in the pushed payload 2.drag and drop it in xcode, than add to build targets

razam217 commented 8 years ago

@mateuszgwozdz why do we need to add it separately in xcode. Is there any automated way to include a file in xcode.?