Skip to content Skip to sidebar Skip to footer

Aws Sns - Push For Gcm Showing As Sent From Cloudwatch But Not Received In Mobile Device

I am migrating from custom Push Notification to AWS SNS. I did the following. configured AWS SNS Topic Created Platform Application created Endpoints Suscribed endpoints to Platf

Solution 1:

The GCM payload format is updated. This works for me.

{
"GCM": "{ \"notification\": { \"body\": \"hello....\", \"title\": \"title123\" } }"
}

Solution 2:

There is a problem with my message formation. I figured it out by debugging with android . The Push reached the device but it was not in the expected format. So the push was not shown in the device. I was sending

{"GCM"=>{"data"=>"{\"message\":\"message\",\"url\":\"url\"}"}, :default=>"default"}

But the Android system was expecting 'badge' and some other keys in my message. I tried with

 {:default=>"default", :GCM=>"{\"data\":{\"message\":\"test\",\"url\":\"https://s3.amazonaws.com/mcds_fulltext/aapg/gsaapgbull/issues/74/android_hdpi/cover_74.gif\",\"registration_ids\":\"arn:aws:sns:us-****-1:*********7:endpoint/GCM/gs*****_gcm/*********************\",\"badge\":\"10\",\"vol\":\"128\",\"issue\":\"10\",\"journal_name\":\"gsaapg\",\"abbr\":\"aapg\"},\"collapse_key\":\"New Article badge\"}"}

Now it works as expected.

This particular JSON might not be appropriate for everyone. But the cause of this issue is the message JSON is not in the expected format for the mobile app. This might be helpful for someone who face the similar issue.

Post a Comment for "Aws Sns - Push For Gcm Showing As Sent From Cloudwatch But Not Received In Mobile Device"