GCM demo server sending message to device raises 401 error

前端 未结 4 1870
既然无缘
既然无缘 2021-01-20 01:50

As many other newbies to java and android i\'m trying to run gcm demo server and gcm demo client on windows, using eclipse to run vertual device and tomcat as a webserer.

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-20 02:29

    This issue is not addressed well on any of the forum may be because it has multiple causes. My case was: I was doing a demo of GCM push notifications and it worked the first time. But as I proceeded next day with same code i found the exception mention in the answer. On observation, I noticed that my public IP had changed as it is not static. This IP has to be provided when you create project on google developers console. You can find your public IP by searching "my public IP address" in google. Or for demo purpose i would now strongly recommend you to use IP as 0.0.0.0/0 which is recommended and when you deploy your project, your server IP would be static. You can then replace 0.0.0.0/0 IP with your server IP. Also, check all the keys like 'project number' and 'server API key'. Hope it helps. CHEERS :)

提交回复
热议问题