-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Custom notification sound in background mode? #17
Comments
Anyone had the opportunity to test it? It's a bug or it's possible I'm doing something wrong? |
@sebrojas14 root cause of the issue is sounds in the assets folder are private to the app and not accessible from the notification service. |
@sebrojas14 So, I've been working on this a bit tonight. The sound file will need to get copied from the asset/www folder to the res/raw folder on Android in order to work. I will look at creating a hook for this soon and test on iOS as well. |
I'm glad to know it, please let me know if you need anything, test on Andorid for example |
@sebrojas14 if you pull the latest from this github repo then you can test. You have to put the sound file in the |
I tried it but doesn't work. I put the beep.wav file in platforms/android/res/raw, and if I look into the apk file is in it. In the payload I sent 'soundname': 'beep'. Missing something? |
@sebrojas14 sorry, did you pull from the issue17 branch? |
Nooo, my bad. This afternoon I'm gonna try again, I need it so bad. What about iOS? |
@sebrojas14 No, my bad. I forgot to mention the branch. I took a look at iOS and it should work but I need to double check where the sound should be packaged on iOS. |
Ok, let me know |
It works on Android (OnePLus One, OxygenOS, Android 5.0.2, using a .wav audio and a .mp3)!! But the sound starts and starts again like half a second later (so is cropped and then it plays all). And in foreground is worst, starts over and over again |
I'm gonna used in an app besides that. Please let me know when you know something about iOS |
@sebrojas14 I'm testing on a Nexus 5 and Nexus 6 running Android 5.1.1 and can't reproduce. |
What about iOS? |
@sebrojas14 swinging back around to iOS tomorrow :) |
@sebrojas14 I got a chance to test this and it works. If I do the following to generate a proper sound:
and put the resulting
I hear the correct sound. See this link for more info: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW6 |
Merged the fix |
What do you mean "put the resulting sub.caf in the root of my Xcode project". In the directory /platforms/ios/ ? or /platforms/ios/project_name/ ? Or inside the xcode project tree? Documentation is not so clear about it, neither about if we have to pass |
@alexislg2 It would be |
Thanks. In fact what I didn't get was that I have to drag and drop the file On Thu, Sep 10, 2015 at 5:16 PM, Simon MacDonald notifications@github.com
|
Here we are in Sep 2016 and this issue raises its ugly head again :-) I have working files residing here: "www/snd/beep.caf". I'm referencing these files from the APN server with the same relative path in the notification payload. These work on IOS 9 but not on IOS 10.0.1 (from the same build!). Either its a new behavior triggered by compat layers in IOS 10 or its a bug in IOS 10. Here's a thread: http://stackoverflow.com/questions/39400703/ios10-custom-push-notification-sound-not-playing. My impression is that it's not as straightforward as the answer suggests. That is, the claim there is that it's an xcode 8 bug. I'm not confident that the relative path references should be expected to work or fail (though they work on iOS 9) and welcome any thoughts/comments on this matter., |
same issue here with ios 10 Using version 1.8.2 of the plugin and testing on iphone 6s. sound was working fine on ios 9 and even on ios 10 when running the app using cordova run ios. The issue only occurs when running with xcode not sure about the store version yet. |
This thread has been automatically locked. |
Why I can't the app play a custom sound with the notification when is in background? I'm sending the sound name in the notification...I neither can make this to work in the previous version of the plugin.
I have beep.wav in my www folder. For Android I'm sending 'soundname': 'beep.wav' in the payload, and 'sound': 'beep.wav' for iOS
My code:
App:
The text was updated successfully, but these errors were encountered: