GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-03-16T14:11:01.000+0000 |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | Arrow Push |
Labels | android, defect |
Reporter | Zarir Bhesania |
Assignee | Shak Hossain |
Created | 2017-03-09T17:31:55.000+0000 |
Updated | 2017-03-16T14:11:01.000+0000 |
ACS push notifications are breaking. It displays JSON payload in the notification body. Please check the attached screenshot. I am assuming the break is due to some special character like hyphen.
Hello, I tested ACS push. It's working fine. Please share code that you are using. I am using a sample code from http://titaniumsolution.blogspot.com/2016/12/sending-push-via-firebase-api-key.html. Thanks.
The notification is sent from the php server. Its not the front end code that breaks the notifications, its something with the server side push. I am pasting the code below $username, 'password' => $password); /*** INIT CURL *******************************************/ $curlObj = curl_init(); $c_opt = array(CURLOPT_URL => 'https://api.cloud.appcelerator.com/v1/users/login.json?key='.$key, CURLOPT_COOKIEJAR => $tmp_fname, CURLOPT_COOKIEFILE => $tmp_fname, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => "login=" . $username . "&password=" . $password, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_TIMEOUT => 60); /*** LOGIN **********************************************/ curl_setopt_array($curlObj, $c_opt); $session = curl_exec($curlObj); /*** SEND PUSH ******************************************/ $c_opt[CURLOPT_URL] = 'https://api.cloud.appcelerator.com/v1/push_notification/notify_tokens.json?key='.$key; $c_opt[CURLOPT_POSTFIELDS] = "channel=".$channel."&payload=".$json."&to_tokens=".$to_tokens; curl_setopt_array($curlObj, $c_opt); $session = curl_exec($curlObj); /*** THE END ********************************************/ curl_close($curlObj); header('Content-Type: application/json'); die(json_encode(array('response' => json_decode($session)))); ?>
So, you are not using our ArrowDB server for push? We checked and the push is fine from ArrowDB. The problem is with your php script. Can you try with the code here https://gist.github.com/ricardoalcocer/51b63b6ddba293c83c3e ? Thanks.
Check [this link](https://www.fusetools.com/community/forums/general/push_notifications_body_json_structure) that states that Android notification responses are usually under the "notification" object I guess.
@Sharif The gist link you pasted has identical code as mine accept for one thing. My code has header('Content-Type: application/json'); which is not present in the link.
Hello [~zarirbhesania@gmail.com], Can you get back on Hans comment? Thanks.
Hi Sharif AbuDarda, I figured out the issue. The push payload was breaking because of "&" used in the title/message. With URL encode this issue is resolved. For both iOS and android common payload structure is used.
Thanks for letting us know. Closing the issue.