0
我對Google FCM很困惑。 文檔頁面https://firebase.google.com/docs/cloud-messaging/http-server-ref列出了API支持的參數,但奇怪的是,「badge」參數僅顯示爲「iOS」。谷歌FCM:徽章櫃檯限於iOS?
我正在設置我的android應用程序徽章計數器,直到上週成功,但今天,在「通知」部分發送參數「徽章」不起作用。通知成功到達。
我通知數據結構:
Array
(
[to] => (device token)
[notification] => Array
(
[title] => Title
[text] => Test message
[sound] => default
[vibrate] => 1
[badge] => 2
)
)
我的服務器端代碼(PHP):
$jsonData = json_encode($data);
$ch = curl_init("https://fcm.googleapis.com/fcm/send");
$header = array(
'Content-Type: application/json',
"Authorization: key=".MY_GCM_API_KEY
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
$result = curl_exec($ch);
curl_close($ch);
嗯...這個答案現在仍然有效嗎? – Ionut
是的。在O android中引入了徽章,但它們是由系統自動處理的,無法控制。 –