1

我们为 ios 设备发送的所有通知都不在其有效负载中包含声音。

以下是接收到的有效负载示例:

{
  "aps": {
    "alert": {
      "title": "s",
      "body": "s"
    },
    "content-available": 1
  },
  "data": {
    "pinpoint": {
      "campaingn": {
        "campaingn_activity_id": "f3b2ca3b26eb400eab98f94769d47f64",
        "campaingn_id": "1f203ef3952c47939c9fb69144f445ca",
        "treatment_id": 0
      },
      "deeplink": "tebbaby://webteb/rateapp"
    }
  }
}

缺少声音属性。我找到了回复: https ://forums.aws.amazon.com/thread.jspa?messageID=793536

广告系列现在具有指定原始有效负载的功能,您可以在其中指定通知的声音文件名。

但我找不到文件。有没有“指定原始有效负载”的例子?

谢谢。

4

1 回答 1

0
    $client = AWS::createClient('pinpoint');

    $ios_payload = json_encode(array("aps" => array("alert" => "This is a test message", "sound" => 'default')));

    $result = $client->createCampaign([
        'ApplicationId' => '7e90856d1934410f978b59f4d75xxxxxx',
        'WriteCampaignRequest' => [
            'AdditionalTreatments' => [
                [
                    'MessageConfiguration' => [
                        'APNSMessage' => [
                            'Action' => 'OPEN_APP',
                            'Body' => 'hello world',
                            'RawContent' => $payload,
                            'SilentPush' => false,
                            'Title' => 'title',
                        ],
                    ],
                    'Schedule' => [
                        'Frequency' => 'ONCE',
                        'StartTime' => 'IMMEDIATE', //date(DateTime::ISO8601)
                    ],
                    'SizePercent' => 1,
                ],
            ],
            'IsPaused' => false,
            'MessageConfiguration' => [
                'APNSMessage' => [
                    'Action' => 'OPEN_APP',
                    'Body' => 'hello world',
                    'RawContent' => $payload,
                    'SilentPush' => false,
                    'Title' => 'title',
                ],
            ],
            'Name' => 'test no rawcontent5',
            'Schedule' => [
                'Frequency' => 'ONCE',
                'IsLocalTime' => false,
                'StartTime' => 'IMMEDIATE',
            ],
            'SegmentId' => 'bfc6dd7be3074e978ca40afdc0cxxxxx',
            'SegmentVersion' => 1,
        ],
    ]);
于 2018-03-03T04:16:21.360 回答