"Hi, Amazon!", "timeStamp"=>curdate(), "expiresAfter"=> "8600")); $url = "
https://api.amazon.com/messaging/registrations/'$RegisterationId'/messages"; $headers = array('content-type : application/json', 'accept = application/json', 'X-Amzn-Type-Version : com.amazon.device.messaging.ADMMessage@1.0', 'X-Amzn-Accept-Type : com.amazon.device.messaging.ADMSendResult@1.0', 'Authorization : Bearer .$accessToken'); $fp = curl_init(); curl_setopt($fp, CURLOPT_URL, $url); curl_setopt($fp, CURLOPT_HTTPHEADER, $headers ); curl_setopt($fp, CURLOPT_POST, 1); curl_setopt($fp, CURLOPT_HEADER, 1); curl_setopt($fp, CURLOPT_SSLVERSION,3); curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($fp, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($fp, CURLOPT_POSTFIELDS, $data); $response = json_decode(curl_exec($fp),true); ?> I changed the php code (send the message). So, there are no server error. But, when i checked the Logcat of eclipse, I can't see any message(signal) that the app received. What am I doing wrong ?
Hi Yooniy, Thank you for posting. There is post where we discussed about sending message in PHP.
https://forums.developer.amazon.com/forums/thread.jspa?threadID=1087&tstart=30 Some times adm message takes time to reach to the devices. Can you check one thing? While the message is successfully sent from server try to press "sync" button in the device and see whether you get call back in onMessage() in your app. Also please check what is the http response code you are receiving in the server against the send message request. You will get the details about the response codes here :
https://developer.amazon.com/sdk/adm/sending-message.html#ResponseFormat In php, you can get http response code in this way: $httpCode = curl_getinfo($fp, CURLINFO_HTTP_CODE); Please revert back if the problem persists and you are unable to get any clue. Thanks.