IO Exception while accessing Google Cloud message?

℡╲_俬逩灬. 提交于 2020-01-07 02:28:25

问题


I have written the code for GCM both in server and Android. I am getting the Registration ID successfully.But I am not able to register to GCM,while making a post to register it shows an IO exception.I have used Android hive tutorial for this.I have gmail id and registration id with me and also created a Url to post.Any idea please share with me.Thanks in advance


回答1:


These are the line of code that creates the exception:

int status = conn.getResponseCode();
if (status != 200) {
   throw new IOException("Post failed with error code " + status);

Basically this methods is responsible for sending a POST request to the server. Have you configured the endpoint URL correctly in the client app?

Edit: The status code 302 is "Found: The requested resource resides temporarily under a different URI." See here for more info: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html



来源:https://stackoverflow.com/questions/15037454/io-exception-while-accessing-google-cloud-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!