iOS: How to stop playing previous notification custom sound using FCM.
I’ve been working on FCM & React native recently and I faced this issue.
I use Firebase Cloud Messaging.
- Push a notification with custom sounds which is 24 seconds. (when a user is calling)
{
"notification": {
"title": "message 1",
"body": "message 1",
},
"token": "token",
"apns": {
"headers": {
"apns-priority": "10"
},
"payload": {
"aps": {
"sound": "customize_file",
}
}
},
"android": {
"priority": "high",
"notification": {
"sound": "customize_file",
"channelId": "aci"
}
}
}
- Push an another notification with no sound. (when a user stops the call)
{
"notification": {
"title": "message 2",
"body": "message 2",
},
"token": "token",
"apns": {
"headers": {
"apns-priority": "10"
},
},
"android": {
"priority": "high",
"notification": {
"channelId": "aci"
}
}
}
- After the second notification, I want the sound to stop but it keeps ringing.
I tried apns-collapse-id
but it doesn’t seem working because message1 is already sent.
I want the sound to stop after the second notification,
New contributor
Stella is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.