caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

Push notification data object showing null value #86

Closed max1020 closed 6 years ago

max1020 commented 6 years ago

I am using version 3.0.1 and it works great - one can register and the push notifications are showing up correctly in the notification bar.

When i click on the notification (app is in the background), the app opens correctly but the payload looks strange:

push payload stringified {"inBackground":true,"data":"{\"c.i\": \"null\"}"}

The push notification contains some values that need to be passed to a file like below:

var question = data; console.log("data push received " + question); Alloy.Globals.UI.openWindow('answerQuestion',{title: question});

The answerQuestion file is called (console.log on this file shows the object) but the data seems to be screwed up. This works fine with iOS but I can't get it to work with Android.

parnanzio commented 6 years ago

I'm having the same problem, with v3.0.0 and v2.0.7 😟

parnanzio commented 6 years ago

Just a small hint: following the format suggested in the README (with the double data field) it works:

$json = [
  "registration_ids" => [
  "cAU7A9Xo8T8:APA91bF9tkp5XeBmAdQqpemHupAhzXL9RDR727yRl9TEzl3mnQugxhaTi1POYepV74AszvlyN7dxbyJV2VJhW52m0-hWjZIfcIMmy3Zf11y0dHYgBHZ_GeAhhCpviR5CZaMUFcanq7ze"
  ],
  "data"    => [
    "data"  => [
      "alert"     => "Testing " . time(),
      "title"     => "The title",
      "vibrate"   => [100,50,50,50,100],
      "badge"     => 1,
      "tag"       => "APP",
    ]
  ]
];
max1020 commented 6 years ago

thanks for the tip!