cordova-plugin-firebasex icon indicating copy to clipboard operation
cordova-plugin-firebasex copied to clipboard

Custom sound vs documentation vs multiple Android versions + iOS

Open globules-io opened this issue 3 years ago • 6 comments

Here is the payload that I'm sending through firebase. I have linked my sound in my config and created a channel when the app starts. Both the sound and the channel are named "test". The sound works when the app is in the foreground only.

window.FirebasePlugin.createChannel({id:'test', sound:'test'});

Here's my payload

{"priority":"high","registration_ids":["xxxxxxxx"],"apns":{"payload":{"aps":{"content-available":1,"sound":"test.caf"}}},"data":{"notification_foreground":"true","notification_android_sound":"test"},"android":{"notification":{"icon":"fcm_push_icon","sound":"test","channel_id":"test"}},"notification":{"body":"Some Text","title":"Some Title","icon":"fcm_push_icon"}}"

My config links the sound properly (it works when app in foreground)

<resource-file src="res/sounds/test.mp3" target="app/src/main/res/raw/test.mp3" />

From the rest I ran, here what I get

  • App is not running, notification is received in tray but sound is not played
  • App is running in the background, notification is received in tray but sound is not played
  • App is running in the foreground, notification is received in tray and sound is played

These were on Android 6.0.1 [email protected]

How do I play the custom sound when the notification is received when the app is not in the foreground please (or at least when in the background)? Thanks.

globules-io avatar Nov 26 '20 18:11 globules-io