Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not receiving GCM push notification from Amazon SNS

I am trying to send Push notification to android app through php. I setup amazon sns account and created SNS Platform using Google Server key for GCM API.

Using AWS credentials, i wrote a cron which reads notification message from database and publishes to sns service using amazon php api. I am getting Amazon endpoint in cron on which i publish notification.

I am receiving status as pass and a requestid for notification. But actual notification is not receiving on device.

Array ( [data] => Guzzle\Service\Resource\Model Object ( [structure:protected] => [data:protected] => Array ( [MessageId] => ac9e1d0c-43a4-5d1a-833d-50c94465421d [ResponseMetadata] => Array ( [RequestId] => c1da8997-2e32-50d0-a092-c45229f36fd7 ) ) ) )

Steps I followed:

  1. Created google API credentials for GCM. Used projectid in app and Server key for Amazon platform

  2. Created user in aws and added policies with all access for sns

  3. Used amazon user credentials in php aws api

  4. Created amazon sns application platform form Android/GCM and used google server key there.

  5. Added Application ARN received from above steps to php api calls.

  6. In php cron, created AmazonEndpoint for device using registration_id received from GCM.

  7. Published notification message on amazon endpoint.

  8. and stuck ......not receiving notification on device even after getting success status in api call

Can anyone tell me exact steps? Am i missing anything?

like image 474
Bhushan Avatar asked Oct 19 '22 12:10

Bhushan


1 Answers

I used Firabase and AWS SNS service for sending from php. I did it step by step according to this video tutorial https://youtu.be/iBTFLu30dSg (on russian but with English subtitles). It works well for me now and I successfully receive push notification from my php code on the mobile devices

like image 199
Arbron Avatar answered Nov 03 '22 02:11

Arbron