当前位置: 动力学知识库 > 问答 > 编程问答 >

php - GCM giving blank response After regenerating API KEY

问题描述:

I am using Google Cloud Messaging from last one year with PHP as server side script and it is working fine on all app until I hasn't sent notification to one of the may application for one month then after that while sending notification to same app I gets blank response like

{"status":[],"0":"\n\n

so I assumed that google may have deactivated my API key so I regenerated my API key from developer console and replaced regenerated key with old key on server side and at that time it had worked I was able to send message again but after two week again I am getting blank response like given above and this time I was sent notification to same app everyday.

网友答案:

From this related SO question. It suggested to make sure that it's retrieving the POST variable in your PHP code.

Try to replace this:

$message = array("Notice" => $_POST['message']); 

with:

$message = array("Notice" => "testing");

You can also check on this tutorial and thread on how to integrate GCM in PHP backend properly.

网友答案:

Problem is solved after importing project into firebase. Server API Key is auto generated by google services and after using those keys on server site i am able to send notification.

分享给朋友:
您可能感兴趣的文章:
随机阅读: