Speed: This is the perceived speed of a network connection we all experience. It is usually assumed the result of bandwidth (such as a 2 Mbps connection vs 512 Kbps connection). Bandwidth is the maximum data rate supported by a connection.
Latency: It is the time from the source sending a packet to the destination receiving it. A good example would be a satellite internet connection. It has a high bandwidth and also a high latency. A delay of 500ms is considered normal in satellite connections (<25ms latency is ideal for DSL connections) Even though the network has high bandwidth, a webpage would take a few seconds to start loading and quickly load completely after that. The delay here is due to latency and not bandwidth.
Latency can be because of propagation delays such as satellite or transmission delays due to the physical properties of the medium used for communication.
Having dealt with the concepts of speed and latency, we will now see how to test Android applications on different networks and see how our applications to conditions similar to those of actual use.
Android SDK ships with device emulator. The emulator can be found in the android-sdk /tools folder of your SDK directory. A virtual device can be created that emulates the phone. Android Virtual Device or AVD for short can be launched both from command line and from within Eclipse IDE.
Every AVD is assigned a separate port, starting from port number 5554
Any AVD runs behind a firewall and is shielded from the network on which the host system runs. The IP address assigned to emulator’s gateway, primary DNS (as well secondary and tertiary), and each instance of AVD, has an IP address of scheme 10.0.2.X
To manipulate network of the emulator, we need to set up redirection. In this tutorial, we will do this via command line after connecting to an AVD’s console. There is another method which can be used using Android Debug Bridge (ADB). Once you are comfortable with command line, you are welcome to explore the method using ADB.
Don’t forget to ‘@’ symbol otherwise the emulator tool would give an error. You can also give network command here at the time of starting the AVD or continue with the rest of the tutorial to issue commands to an already started AVD.
For setting speed at start up:
emulator @deviceName -netspeed gsm
emulator @deviceName -netspeed 14.4 80
Step 3: Enable Telnet on Windows 7 or 8
Open ‘Control Panel’
Click on ‘Programs and Features’
Click on ‘Turn Windows features on or off’
Select ‘Telnet Client’ from the list that appears.
Step 4: Connect to AVD’s Console
After starting your AVD, you would see a port number before its name in followed by colon like this:
You can also use ‘adb’ tool to find out the port number by using the following command:
which will list the virtual devices along with their port numbers
List of devices attached
You have the information you need to connect to the AVD.