简体   繁体   中英

IOS Push Notification custom sound not working

Im using Parse CloudCode to send a push notification to my users. I'm having trouble playing the custom sound "pushSound.wav" on my app. I know the sound works because I sent a manual push with the push service I'm using, onesignal. In the options field of this manual push I set the sound to "pushSound.wav" and the sound played.

I just do not know where to put the sound key in the JSON body parameters.

  var jsonBody = {
      app_id: "xxx",
      sound: "pushSound.wav",
      tags: [{"key": "userId", "relation": "=", "value": user}],
      contents: {en: "Pop Pretty Please"},
      data: {"type":type, sound: "pushSound.wav"},
  };

From OneSignal documentation :

ios_sound : Sound file that is included in your app to play instead of the default device notification sound. Pass "nil" to disable vibration and sound for the notification.

Example: "notification.wav"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM