FCM推送通知图像PHP

时间:2018-03-13 06:13:09

标签: php android push-notification

想知道如何在右边实现图像?似乎无法在官方firebase网站上找到有关该实施的任何文件。

可以查看我想要实现的内容的附件。 enter image description here

这是我的代码的一部分

$msg = array(
    'message'   => 'testing',
    'title'     => 'testing title',
    'subtitle'  => 'Support!',
    'vibrate'   => 1,
    'sound'     => 1,
    'largeIcon' => 'large_icon',
    'smallIcon' => 'small_icon'
);

$fields = array(
    'registration_ids' => $registrationIds,
    'data' => $msg,
    'priority' => 'high',
    'notification' => array(
        'title' => 'Test test',
        'body' => 'Test body',
        'icon' => 'myIcon',
        'sound' => 'mySound'
    ),
);

$headers = array(
    'Authorization: key=' . API_ACCESS_KEY,
    'Content-Type: application/json'
);

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
echo "<h1>CURL_GETINFO</h1>";
print_r(curl_getinfo($ch));
curl_close($ch);
print_r($result);

0 个答案:

没有答案