Search code examples
titaniumappceleratorappcelerator-titaniumappcelerator-arrow

Push notification Titanium shows whole payload instead of the actual message


I'm using cURL to send push notifications to appcelerator, been using this for a while without problems.

Suddenly appcelerator can't handle the JSON payload and shows the whole JSON string as an message on the actual device. This is what our curl post data looks like:

channel=dev&payload={"alert":"The Message","title":"Title","vibrate":true, content-available:1, "badge":"+1", "sound":"default", "id":617, "icon":"appicon"}&to_ids=everyone

And this is what my device shows as push notification:

"{
   "alert":"The Message",
   "title":"Title",
   "vibrate":true, 
    content-available:1, 
   "badge":"+1", 
   "sound":"default", 
   "id":617, 
   "icon":"appicon"
 }"

instead of: "The Message"


Solution

  • Turns out there was a \n in the JSON that broke the JSON string. building a Array first then using json_encode() in PHP fixed the issue