Open dror3go opened 9 years ago
your json is error; miss ']' it should be like this
$data = json_encode([ 'aps' => [ 'alert' => 'Text to see in the notification', 'sound' => 'default' ]]);
That was just a typo in my example, @LiangJianle.
the problem is that ZendService\Google\Gcm\Message use a toJson method to build the json for you and put everything that yoo send inside data key.
for use both we need to put in this way notification :{ body:'text', title:'text' } to see on ios but until now it is impossible, i looking to see i way to do that
Hello,
How to set 'aps' parameter inside the PushNotification::Message ?
From my understanding, iOS (at least in some versions) takes care of the push notification in cases when the app is not open, and it requires a specific JSON format:
If it gets this kind of object, iOS will display nicely the notification, with the sound and the defined text.
I want my code to be indifferent of the device (APNS/GCM) it sends to, so I prefer to send the same object to all. How can I send it as an object not decoded? When I tried it - Android devices didn't get any push notification.
Am I missing something?