I was just wondering if anyone solved this problem. Googling gives tons of posts having this question but not one with a proper reply. I tried literally every combination of the following two pieces of code with and without proxy:
/*********** URL METHOD ***************/
//URLConnection conn = aURL.openConnection();
//conn.connect();
//InputStream is = conn.getInputStream();
/*********** HTTP METHOD ***************/
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(urlString);
HttpResponse resp = client.execute(get);
InputStream is = resp.getEntity().getContent();
I am trying to connect to a site on my intranet (its not localhost). I've tried the following:
Any thoughts?
You should check out this : http://developer.android.com/guide/appendix/faq/commontasks.html#localhostalias
(use the alias "10.0.2.2" instead of "localhost" or "127.0.0.1")
You need to give proper permissions to the app in order for it to use internet.
try adding following line in your application manifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourpackage"
android:versionCode="1"
android:versionName="1.0" >
..
..
<uses-permission android:name="android.permission.INTERNET" />
</manisfest>
At least this worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With