I am trying sending data from android application (with emulator) to web server (a php page) nowadays. Firstly, I had tried this program with emulator and it was working. After that, I tried this program with telephone and an exception occurred :
--> IO Exception : The operation timed out.
One part of my code :
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://10.0.2.2:90/takeDatas.php");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("enlem", latitude ));
nameValuePairs.add(new BasicNameValuePair("boylam", longitude ));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
httpclient.execute(httppost);
} catch (ClientProtocolException e) {
Toast.makeText(ReportLocationActivity.this, "Client protokol exception ", Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(ReportLocationActivity.this, "IO exception "+e.getMessage(), Toast.LENGTH_LONG).show();
}
I hope you will help me. Thanks in advance.