[AC-2407] ACS Push Notifications: No sending logs found for this push notification
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2014-03-14T22:31:33.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Derrick Huth |
Assignee | Eduardo Gomez |
Created | 2013-03-31T23:46:26.000+0000 |
Updated | 2016-03-08T07:41:26.000+0000 |
Description
I am trying to send push messages using Appcelerator Cloud Services. The messages will be generated by a PHP web script. I can successfully send messages to devices from the ACS console either using UserIDs or to all devices so I know I have app set up OK to receive notifications.
When I send from my website I get a Status: OK and Code:200 response that indicates all is well. However, the push messages are never delivered, either to ios or android devices.
When I check the ACS push notification logs I see an entry with these details:
Sender:Web Console
Channel:(Correct Channel)
Payload: [object Object]
Created At: (Current Time)
To_IDs:(Correct UserID)
When I click the details button I get a message that says:
"No sending logs found for this push notification. Push notification logs of requests will be visible here when push notifications are sent to subscribers of this app."
It seems to imply that there is nothing wrong with my request, ACS just can't be bothered to deliver it to the device! This remains the same several hours later. I have reduced the payload to a single text item and tried removing all other non essential key:value pairs without success.
If it allows you to view logs my APP key is 8VI7Zd9lp6u7BjIQr5GxOtfF1fjnY3RP, many messages were sent 31 March 2013 18:00 to 00:00
If it helps the structure of the PHP webpage is as follows:
$tmp_fname = "cookie.txt";
$url = 'https://api.cloud.appcelerator.com/v1/users/login.json?key=...............................';
$fields = array(
'login' => 'xxxxxxxxxx',
'password' => 'xxxxxxxxxxx',
);
$headers = array('Content-Type: application/json');
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $tmp_fname);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, $tmp_fname);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
$url = 'https://api.cloud.appcelerator.com/v1/push_notification/notify.json?key=................................';
if ($phonetype = '0') {
$sound = 'alert.wav';
} else {
$sound = 'sound/alert.wav';
}
$payload = array(
'title'=>'Offer from '.$company,
'oi'=>$nid,
'ci'=>$uid,
'cn'=>$company,
'i1'=>$image1,
'i2'=>$image2,
'de'=>$enddate
);
$fields = array(
'to_ids' => $registration_ids,
'channel' => 'iloyalty',
'badge'=>$badgeNo,
'sound'=>$sound,
'icon'=>'appicon',
'alert'=>$title,
'title'=>'Offer from '.$company,
'payload' => $payload
);
$headers = array('Content-Type: application/json');
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
Try the code provided here: https://github.com/PatrickJongmans/push_acs_php/blob/master/example_acs.php and let me know if you have better luck. What you have here is very close but getting this example to work will at least let us know if this is a problem on our end or yours. Regards, Carter
Many thanks, I have got it working now, although I still feel that there is an issue in the following respects: 1. It would be great to have the example code linked to in the previous comment included in the ACS documentation as the only resources available at the moment are in the community Q&A, some of which work, most don't! 2. Ideally when the json payload is incorrectly format the ACS log would report that, not the current situation where it reports success but no delivery.
Hi Derrick, So as far as I can tell this issue is solved - if you would like the issues that you listed addressed, please file separate JIRAs so that they can be handled accordingly. Thanks!
Cloud Engineering will deliver this fix in the next deployment cycle. Rationale: The Push Dispatcher doesn't handle this good enough to raise exception and save failed status into log. This indicates there was a problem on GCM side and returned status was not 200. By searching online, this relates to a GCM bug. - http://stackoverflow.com/questions/12090791/have-a-java-lang-illegalargumentexception-exception-try-to-send-gcm-message - http://stackoverflow.com/questions/11878428/exception-on-web-server-while-implementing-google-cloud-messaging - https://code.google.com/p/gcm/issues/detail?id=7 Also when meeting "argument cannot be null", mostly their GCM API Key is not correct. This message is what we get from GCM library side. Please refer screen shoot attached: http://www.screencast.com/t/QuXDkm66H4