3
PHPのサーバー側からいくつかの登録IDに通知を送信しています。 これが要求です:複数のregistration_idsを対象とするとfcmの登録IDが失敗しました
public function androidPushNotification($registration_ids, $title, $message) {
$msg = array (
'message' => $message,
'title' => $title
);
$fields = array (
'registration_ids' => $registration_ids,
'data' => $msg
);
$headers = array (
'Authorization: key=' . $this->API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $this->GCM_URL);
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);
curl_close ($ch);
return $result;
}
registration_ids変数が配列で2つの登録IDを持って、そのうちの一つは、クライアントアプリケーションの古いインストールからのものであり、その他は現在のものです。
私はFCMからこの応答を取得しています:
{
"multicast_id": 7860323906688398625,
"success": 1,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "NotRegistered"
},
{
"message_id": "0:1478735313889582%1b153de0f9fd7ecd"
}
]
}
どのように私は失敗した登録IDのかを知ることができますか?
この情報を取得する別のオプションはありますか?
よろしくお願いいたします。