Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connecting Internet from android code

 
rashmi swamy
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of SDK are you using?
 
rashmi swamy
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
android SDK 2.2
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For 2.2, you don't have to explicitly setup proxy in the emulator(i.e. you wont have to change an entry in the System table, nor start with -proxy switch, neither would you have to create additional APNs).

In your java code, if you are running from behind a proxy just add your credentials to the HttpClient instance.

Something like:

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 2.2 emulator has an issue with networking that most real devices don't have (namely, it doesn't support IP6). Try a 2.1 emulator or an actual 2.2 device.
 
rashmi swamy
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou Monu.
I have put your code in my activity class and trying load www.google.com through web view. But it is not working. Please give me some solution.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:The 2.2 emulator has an issue with networking that most real devices don't have (namely, it doesn't support IP6). Try a 2.1 emulator or an actual 2.2 device.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic