0

I know there are lots of questions about this matter but I just could not find an answer to this one in specific. I am trying to access

        HttpClient client = new DefaultHttpClient();
        URI website = new URI("http://10.0.2.2:8000/timecode");
        HttpGet request = new HttpGet();
        request.setURI(website);
        HttpResponse response = client.execute(request);
        response.getStatusLine().getStatusCode();

I am NOT testing on my emulator, Im testing with my real android device. Ive tried 127.0.0.1, Ive tried with my external ip

http://externalip:8000/timecode

Ive tried with 192.168...and still got the same Exception.

Can anyone help me ?

Akash
  • 367
  • 9
  • 21

1 Answers1

0

A common mistake is forgetting permissions. Did you add necessary permission on your manifest?

<uses-permission android:name="android.permission.INTERNET" />

Also, don't forget to disable firewall.

mamba4ever
  • 2,662
  • 4
  • 28
  • 46
  • Try using emulator. If it doesn't create a problem, we can decrease the number of possible error reasons. – mamba4ever May 12 '13 at 05:15
  • When I use the emulator it gives another exception: ClientProtocolException (or to be more specific, org.apache.client.CLIENTPROTOCOLEXCEPTION – Akash May 13 '13 at 12:16