IOS FCM notification does not play when received

I am using PushBase notifications in an iOS app. Although I can send a notification by sending a payload below, it does not play sound when received.

{ "to": "myToken", "notification": { "body": "test", "title": "test" }, "priority": "high" "sound": "default" } 

If I send a test message from the console, it works well and plays a notification sound.
Note :

  • My authorization code is correct
  • I am sending an http request to https://fcm.googleapis.com/fcm/send
  • I tested it on the iPhone 4, iPhone 6 and iPhone 6S, all receive notifications without sound
+10
source share
3 answers

your JSON "sound" : "default" should not be inside the "notification" key in the JSON root. This JSON should work.

 { "to": "myToken", "notification": { "body": "test", "title": "test", "sound": "default" }, "priority": "high" } 
+23
source

When using the FCM admin SDK, you must separately specify the sounds for Android and Apple devices:

 let message = { notification: { 'body': 'This is the message the user sees', }, data: { 'param1': 'specify some extra data here', }, // Apple specific settings apns: { headers: { 'apns-priority': '10', }, payload: { aps: { sound: 'default', } }, }, android: { priority: 'high', notification: { sound: 'default', } }, token: 'target FCM token goes here', }; 

(Note: I just checked Apple settings)

+6
source
  payload = { notification:{ title: 'SOLO has been changed by an administrator', body: 'Administrator changed your SOLO schedule', }, android: { }, apns: { headers:{ "apns-collapse-id": "solo_changed_administrator", "content-available": "1", "apns-priority": "10", }, payload:{ aps:{ sound: 'default', badge: 12213123223 } } }, data:{ type: 'type' } } 

https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages?authuser=0#ApnsConfig

0
source

All Articles