Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4848] ACS push notifications break

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2017-03-16T14:11:01.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsArrow Push
Labelsandroid, defect
ReporterZarir Bhesania
AssigneeShak Hossain
Created2017-03-09T17:31:55.000+0000
Updated2017-03-16T14:11:01.000+0000

Description

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.

Attachments

FileDateSize
1.jpeg2017-03-09T17:27:00.000+0000128687

Comments

  1. Sharif AbuDarda 2017-03-09

    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.
  2. Zarir Bhesania 2017-03-09

    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)))); ?>
  3. Sharif AbuDarda 2017-03-10

    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.
  4. Hans Knöchel 2017-03-10

    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.
  5. Zarir Bhesania 2017-03-10

    @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.
  6. Sharif AbuDarda 2017-03-14

    Hello [~zarirbhesania@gmail.com], Can you get back on Hans comment? Thanks.
  7. Zarir Bhesania 2017-03-16

    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.
  8. Sharif AbuDarda 2017-03-16

    Thanks for letting us know. Closing the issue.

JSON Source