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