1

I am using Emulator to test app.

Problem is Internet on emulator wont work if laptop is connected to LAN. But it works if I connected with Wifi.

I have gone through many answer of similar kind,

I tried this and this but no luck

Community
  • 1
  • 1
AAnkit
  • 27,299
  • 12
  • 60
  • 71
  • You can look at nonanswered questions as a source of info for thinking, but not as examples to put into your code. – Gangnus Jan 21 '12 at 14:13
  • @Marvin i did that, @ Gangnus, i tried many things,, still same problem, even once my internet stopped working on system too ..:P... – AAnkit Jan 21 '12 at 14:20

2 Answers2

0

You need android.permission.INTERNET, as it was mentioned. You need also:

ACCESS_NETWORK_STATE - to check if you can use Internet and why not

Maybe CHANGE_NETWORK_STATE

also look here

also You can start your AVD in CMD prompt like this

C:\program files\android\android-sdk-windows\tools\emulator -avd -dns-server 8.8.8.8

This is google public DNS. The problem seems to be that the emulator can't find the DNS your computer is currently using. (cite from here)

vnshetty managed with: I edited avd with value "GPS support= yes" and restarted the emulator. now working....

more cite: You don't need to set any setting to access internet on emulator unless you are behind a proxy, in case you are behind a proxy start your emulator from command prompt with following command: C:/emulator -avd avdname -http-proxy http://your.proxy.ip:8080 - it seeems to me even more useful .

Community
  • 1
  • 1
Gangnus
  • 24,044
  • 16
  • 90
  • 149
  • I have read about -http-proxy in other posts as well but I don't have one i.e. one with ip and port but I do have a .pac file , how can I use it instead of an ip and port. – Prateek Jun 21 '17 at 03:39
0

Solution is to turn off wifi if using LAN and vice versa. It works, at least for me.

AAnkit
  • 27,299
  • 12
  • 60
  • 71