Hi there,
I am trying to receive, with my standalone AppGyver app, the ‘data’ part of notifications.
What I send from my backend is:
$url = 'https://fcm.googleapis.com/fcm/send';
$api_key = 'AAAAI....Mp2s';
$fields = array (
'to' => 'dPTX0FCaSmW....uViMIFSidED',
'notification' => array(
'body' => 'This is the body',
'title' => 'Notification's title'
),
'data' => array(
'key01' => 'value01',
'key02' => 'value02'
)
);
$headers = array(
'Content-Type:application/json',
'Authorization:key='.$api_key
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
And what I receive is something like:
{"android":{},"body":"This is the body","title":"Notification's title"}
Does anyone know how I can retrieve the ‘dats’ part of the notification?
Many thanks