我已经在我的应用程序中为通知消息实现了 Amazon Web Service (AWS),我能够成功地从 Amazon SNS 服务器发送消息。
现在我想在从 AWS 收到任何消息时实现默认/自定义声音。
在 Amazon SNS Server 中,有两种发送 pus 消息的选项,即 Raw 和 JSON。我正在使用原始消息格式。
{
"aps":{
"badge":0,
"alert":"APNS test",
"sound":"default"
},
}
通过上述格式,我在我的应用中获得了与推送通知相同的格式。
如果我使用 JSON 消息格式
我进入 Amazon SNS 页面 -
Invalid parameter: Message Structure - JSON message body failed to parse (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: b34a
任何人都可以知道如何使用 AWS Notification 发送默认/自定义声音。
最佳答案
尝试如下
请确保根据您的需要更改 JSON
{
"aps" : {
"category" : "NEW_MESSAGE_CATEGORY"
"alert" : {
"body" : "Acme message received from Johnny Appleseed",
"action-loc-key" : "VIEW"
},
"badge" : 3,
"sound" : "chime.aiff"
},
"acme-account" : "jane.appleseed@apple.com",
"acme-message" : "message123456"
}
关于ios - AWS : Play Custom Sound When Push Messages are received,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40100140/