Simulate a wireless network in an emulator

How to simulate a Wi-Fi network using an emulator?

+4
source share
3 answers

The simple answer is: you cannot. Also, this one was asked before (and yes, it is still valid).

+2
source

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

+1
source

Here is the solution I came up with to simulate the overall loss of network connectivity on an emulator:

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

netcfg eth0 down sleep 10 netcfg eth0 up netcfg eth0 dhcp 

Download the following emulation script with this command:

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

Change permissions

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

Run it

 adb shell /data/local/nonetwork.sh 

While the network is not working on the device, you will also lose access to adb, but as soon as the connection is restored, it will work again. Hope this helps.

0
source

All Articles