Tutorial :Simulate Wireless Network in Emulator


How do I simulate a WiFi network using the Emulator?


Simple answer: you can't. Also, this has been asked before (and yes, it's still valid).


The emulator does not emulate WiFi specifically. It emulates a generic network connection. You can use telnet commands to configure its characteristics (e.g., speed, latency).


Here is the solution I came up with for simulating total network connection loss on the emulator:

Write the following script and name it "nonetwork.sh"

netcfg eth0 down  sleep 10  netcfg eth0 up  netcfg eth0 dhcp  

Upload the following script to the emulator via this command:

adb push nonetwork.sh /data/local/nonetwork.sh  

Change the permissions

adb shell chmod 700 /data/local/nonetwork.sh  

Run it

adb shell /data/local/nonetwork.sh  

While the network is down on the device you'll lose access to adb as well but once the connection is re-established it will work again. Hope this helps.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »