doufu8588 2016-09-29 09:11
浏览 72

AWS SNS推送通知虽然在cloudwatch中显示,但未传递给设备

AWS SNS Push notification is not working for android GCM in my application though same code is working pretty good for IOS. I put cloudwatch to track down the error but it displaying status as delivered in logs but no push notification received in Device.

Relevant code of application

$platform = 1;
$token = 'user-device-token';
$gcmPlatformArn = 'AWS_GCM_ARN';
$ApnsPlatformArn = 'AWS_IOS_ARN';
$message = 'welcome';

$sns = SnsClient::factory([
    'region'  => 'my-region',
    'version' => 'latest',
    'credentials' => [
        'key' => 'my-key',
        'secret' => 'my-secret'
    ]
]);
if ($platform == 1) { //For Android
    $endPointArn = $sns->createPlatformEndpoint([
    'PlatformApplicationArn' => $gcmPlatformArn,
    'Token' => $token
    ]);
} else {
    $endPointArn = $sns->createPlatformEndpoint([
        'PlatformApplicationArn' => $ApnsPlatformArn,
        'Token' => $token
    ]);
}
$endPoint = $endPointArn['EndpointArn'];

return $sns->publish(['Message' => $message,
              'TargetArn' => $endPoint]);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法