I've made A GCM Application.
I made web sever by Node.js and I checked my POST is working well by using Postman.
So, I am making an app that when button clicked, it posts so GCM Message comes to my device.
and this is my post code.
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(SERVER_URL+"/push");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
//nameValuePairs.add(new BasicNameValuePair("id", "12345"));
//nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
Log.v("11111", "11111");
}
I don't have any params with my POST so nameValueParams has nothing.
But in my log cat, it shows log.v("11111","11111");
there is an IOException, what is the problem? My manifest includes INTERNET PERMISSION ALSO.
Every example code has that structure but it goes to IOException.