ios - AWS : Play Custom Sound When Push Messages are received

标签 ios objective-c amazon-web-services aws-sdk

我已经在我的应用程序中为通知消息实现了 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/

相关文章:

php - Firebase 云消息传递 PHP 集成发送推送通知

objective-c - 使用 PHP/MySQL 和 HTTP 响应验证 Iphone 登录

amazon-web-services - 属性验证失败 - AWS::Cognito::UserPool 的 Cloudformation 模板

ios - AWS 上的两个不同域列表,iOS vs scratchpad

amazon-web-services - 关于dynamoDB查询结果的问题

ios - 在 ELCImagepicker 中显示视频和图像

ios - 在 ScrollView 中添加按钮 --> 启动时不会加载 View

ios - 我如何将我的网络代码与我的 ViewController 分开

objective-c - 使用 Xcode 6 或更高版本或 Application Loader 2.9.1 或更高版本提交您的构建

ios - 未调用 continueUserActivity