简体   繁体   English

自定义声音推送通知

[英]Custom sound push notification

I am receiving notification payload as我收到通知有效载荷为

    [AnyHashable("jsonData"): {"packageName":"com.company.appName","appName":"AppName","orderId":"0","workflow":"PAGE_OWNER_STATUS_WORKFLOW"}, AnyHashable("aps"): {
    alert =     {
        body = "You have received a new Order! ";
        title = Orders;
    };
    sound = default;
},AnyHashable("google.c.a.e"): 1, AnyHashable("gcm.notification.jsonData"): {"packageName":"com.company.appName","appName":"AppName","orderId":"0","workflow":"PAGE_OWNER_STATUS_WORKFLOW"}, AnyHashable("title"): Orders, AnyHashable("google.c.sender.id"): 34781329473, AnyHashable("body"): You have received a new Order! , AnyHashable("sound"): phone_ringing.caf, AnyHashable("gcm.message_id"): 1597347128946557]

It does not add sound name in aps alert.它不会在 aps 警报中添加声音名称。 Will it be done from backend?它会从后端完成吗? We are using JAVA for Backend.我们使用 JAVA 作为后端。

I believe the sound property has to be set as a property of the aps and not of the alert object, like you're receiving now and like it is specified in apple documentation .我相信必须将声音属性设置为aps的属性,而不是alert object 的属性,就像您现在收到的一样,就像苹果文档中指定的那样。 Apple example:苹果示例:

{
   “aps” : {
      “badge” : 9
      “sound” : “bingbong.aiff”
   },
   “messageID” : “ABCDEFGHIJ”
}

You should specify the string "default" to play the default notification sound, otherwise a filename must be set and the file needs to exist on the app.您应该指定字符串“default”以播放默认通知声音,否则必须设置文件名并且该文件需要存在于应用程序中。 These changes would have to be done on the server side.这些更改必须在服务器端完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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