• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to connect to the internet behind proxy ?

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Not recently I installed the android SDK for the first time. After
playing with the emulator I notice that I can’t log in to the internet
via the browser application.
I looked for a and found the following command : “emulator -avd em15 -
http-proxy <proxy>”

For the <proxy> I copy the prams’ from the browser (Tools  Internet
Option  Connection  Lan settings ) but still I can’t see any
WebPages via the browser.

Any suggestion ?

Thanks
 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Configuring Android emulator for proxy:

In the earlier versions of Android emulators (up to version 1.1r2), you were required to make an entry in the system table of “com.android.provider.setting.db” database and/or start the emulator with –http-proxy switch supplying it the ip address and port number of your proxy.

These methods however, have become obsolete and don’t work with SDKv1.5.
Step 1: On emulator, go to:
Home->Menu->Settings->WirelessControls->MobileNetworks->Access Point Names->T-mobile US->set Proxy Ip and Port#

Step 2: Now the next time you go to a web address, the browser will prompt for your user-id and password. Enter your credentials and you should be good to go.

Reference: http://groups.google.com/group/android-beginners/browse_thread/thread/069fbb8c7465de38/5ced4f948c4ed622#5ced4f948c4ed622" target="_blank" rel="nofollow">
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks

working nice
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you're welcome!
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Monu

I am also facing the same problem. I tried using the method mentioned in your post. I have entered the proxy and port information in the APN section, but my emulator doesn't seem to connect to the internet. All I get is a page saying that proxy authetication required.

I tried adding the user name and password , that I use to connect to the network, in the APN field, but still it doesn't seem to work. Interestingly, as mentioned in your post, the browser never prompts me for the autentication details, whether I enter the details(in APN section) or not.


Is there something I am missing out, or any other way out of this??


Thanks in advance.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not enter a user name or password on the "edit access point" page and see if the browser asks you for username/password. If it does, enter your username by prepending it with your domain name like:
"<your-domain-name>\<your-user-name>".

If it does not prompt for your credentials then you would have to continue googling and post the answer here if and when you find it!
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Monu,
I am using SDK 2.0. I am facing same prolem.
I have set all the parameter which you have mentioned.

1. Now when I open the browser it will not prompt and it will show me the page.
2. And if I set the username and Password then also it not prompts but again showing me page.

I am developing an application which send the data to server and get the response in JSON.
The code is below:


This will give me error as : java.net.SocketException: Permission denied (maybe missing INTERNET permission)

What setting I am missing?
Is your method working in SDK 2.0?
Check my URL is right coz some one writes the ip:port before that which also not working.

Waiting of your reply.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yours is just a case of missing Permission in the manifest file, as the logs have pointed out.
You will have to add a <uses-permission> in your manifest file(android.permission.INTERNET).
 
vina parmar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Monu,
It's working fine.


 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are welcome... "Mobile Developer"
Why don't you change your display name to something that is more addressable? You know we have a Naming Policy here on the Ranch.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Monu,
I m a newbie to android too and i found that exception too.
In my manifest i already put <uses-permission>, but still have this exception.
here is my create Feed method
(that's from Newsdroid tutorial..)

public void createFeed(Context ctx,String linktext) throws ParserConfigurationException, SAXException, IOException
{
targetFlag = TARGET_FEED;

try {

URL url = new URL(linktext.toString());
droidDB = new NewsDroidDB(ctx);
droidDB.open();

SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
RSSHandler myExampleHandler = new RSSHandler();
xr.setContentHandler(myExampleHandler);
InputStream mystream = null;
try{
mystream = url.openStream();
}catch (Exception e)
{
Log.e("RSS Handler", e.toString());
}
InputSource is = new InputSource(mystream);

try {
xr.parse(is);
} catch (SAXException e) {
e.printStackTrace();

Log.e("xr.pasrse(is)", e.toString());
}

} catch (Exception e) {

Log.e("RSS Handler", e.toString());
}


}
 
Greenhorn
Posts: 14
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Monu,
I am only able to connect internet through emulator browser. I am not able to connect to Internet through application code even after setting proxy in emulator and also inserting values to system table. It is throwing unknown host exception. I tried with one more option that setting proxy in application Run Configuration. But it is throwing Authentication scheme ntlm not supported error. I have given Internet permission in manifest also. Please let me know some solution for connecting Internet through code.

Thanks & Regards,
Rashmi
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rashmi swamy wrote:Hi Monu,
I am only able to connect internet through emulator browser. I am not able to connect to Internet through application code even after setting proxy in emulator and also inserting values to system table. It is throwing unknown host exception. I tried with one more option that setting proxy in application Run Configuration. But it is throwing Authentication scheme ntlm not supported error. I have given Internet permission in manifest also. Please let me know some solution for connecting Internet through code.

Thanks & Regards,
Rashmi



I have the same problem.

I've found that there's a method in the DefaultHttpClient variables called setProxyAuthenticationHandler(AuthenticationHandler proxyAuthHandler) but I have no Idea how to configurate the proxyAuthHandler variable.

Anybody could help on this?

Thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am unable to find/activate the proxy (server and port) settings for my Wi-fi network. I have an HTC Wildfire with android 2.2. I am able to access internet on proxy via Opera browser by entering the required setting there, but still the wifi internet access is not global to my device.

Additionally, the java application I use via the java android app is unable to access internet even from the Mobile data network. Please advise.

I am not sure if this is the right forum to post this. If so, then i request you to direct me to the right source of solution.

Thanks!

-RB

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic