55

I need to test app for work with slow internet connection. How to simulate slow internet connection on Android emulator?

mobiledev Alex
  • 2,228
  • 2
  • 28
  • 30

7 Answers7

79

For Android Studio projects you can do the following:

If you need to change net speed temporarily, then on an emulator toolbar, click three dots (settings), go to Cellular tab and configure the network speed there. You need to have a recent Android Tools.

If you want to set this speed permanently for some emulator image:

  1. Open menu Tools -> Android -> AVD Manager
  2. Select/create your emulator avd image, click Edit
  3. Click Show Advanced Settings button
  4. Set the desired net speed

    Speeds for reference in increasing kbps:

                            UP       DOWN
                      -------- ----------
    gsm   GSM/CSD         14.4       14.4
    hscsd HSCSD           14.4       57.6
    gprs  GPRS            28.8       57.6
    umts  UMTS/3G        384.0      384.0
    edge  EDGE/EGPRS     473.6      473.6
    hsdpa HSDPA         5760.0   13,980.0
    lte   LTE         58,000.0  173,000.0
    evdo  EVDO        75,000.0  280,000.0
    full  No limit           ∞          ∞
    
  5. Re-launch the emulator

OLD ANSWER (obsolete)

If you are working in Eclipse, go to Run->Run Configurations, select your run configuration and then go to "Target" Tab. There you will find a "Network Speed" combobox (under the "Emulator Launch Parameters" section).

If you are running emulator from command line, then you can use "-netspeed" cmd line parameter (run emulator -help-netspeed for overview of possible options)

Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245
dimsuz
  • 8,969
  • 8
  • 54
  • 88
  • is it possible to control that from within an application? – ppbitb Jul 20 '11 at 21:37
  • 1
    I don't think so. Of course perhaps you can make your application to process data it gets more slowly, but I suspect there's no way you can override a system's network speed. That would be awful if you could :) – dimsuz Jul 21 '11 at 17:08
  • Took me forever to find that Network Speed setting, cause there was no scroll bar on the side, and I didn't even think of resizing the window to find it. But thank you for the info. – zidarsk8 Aug 10 '11 at 20:37
  • Yeah, Eclpise sometimes screws up like this. I recall myself being in same situation regarding some other option :) – dimsuz Aug 11 '11 at 10:44
  • 1
    To configure network speed in the emulator 3 dots technique, choose Network type, then choose the type correponding to the speed using the table above. – user1114 Jul 31 '20 at 03:25
  • Nicely answered!! Thanks. – Akash Bisariya Sep 16 '22 at 06:43
26

Easiest way to tweak things while emulator is still up is to connect to the emulator using a terminal. Just use telnet or netcat (interactively, you can just "telnet localhost 5554" and type "help" -- below examples show how to script it:

$ echo "network speed 100 100" | nc localhost 5554
$ echo "network status" | nc localhost 5554
Current network status:
  download speed:     100000 bits/s (12.2 KB/s)
  upload speed:       100000 bits/s (12.2 KB/s)
  minimum latency:  0 ms
  maximum latency:  0 ms

You can also set the delay/latency:

$ echo "network delay gprs" | nc localhost 5554
$ echo "network status" | nc localhost 5554
Current network status:
  download speed:     100000 bits/s (12.2 KB/s)
  upload speed:       100000 bits/s (12.2 KB/s)
  minimum latency:  150 ms
  maximum latency:  550 ms

Just makes it easier to do things at runtime and test various scenarios (via automation, manual testing, etc).

Aequitas
  • 2,205
  • 1
  • 25
  • 51
DustinB
  • 11,037
  • 5
  • 46
  • 54
  • 1
    Thanks for your answer! Unlike using run configuration this worked for me. I also like how you can check your current settings. – Father Stack Nov 12 '13 at 10:32
  • 2
    This is great. So much better to be able to alter the settings while you're running the emulator. Another command I found useful—it delays network by 2 seconds to test loading screens: `echo "network delay 2000" | nc localhost 5554` – phreakhead Dec 13 '15 at 20:41
  • 3
    FYI. now (2020) `echo` can not work as emulators require login `Android Console: Authentication required`,`Android Console: type 'auth ' to authenticate` – Grzegorz Dev Jun 02 '20 at 15:26
  • this solution not working at 2020 `Android Console: Authentication required` – Yohanim Dec 03 '20 at 16:21
  • it's still working, you follow the steps on the screen and paste in your authentication string `Android Console: you can find your in '/Users/username/.emulator_console_auth_token'`. Once you copy that short code, do `nc localhost 5554` then `auth {code}`. The other thing is that this method does the same thing as `adb emu network delay 1000` – 1mike12 Feb 28 '23 at 14:53
  • FYI the correct syntax to set both the download and upload speed is `network speed :` – André Dion May 04 '23 at 13:04
5

Appium set network speed with

adb emu network speed

example:

adb emu network speed gsm

all values(see appium doc ): gsm, hscsd, gprs, umts, edge, hsdpa, lte, evdo, full

4

In Eclipse : Run -> Run Configuratrions -> click!

Select Tab Target. click!

Then there is an option Network Speed!

Set it to emulate whatever you want. :)

Lavanya
  • 3,903
  • 6
  • 31
  • 57
pumpkee
  • 3,357
  • 3
  • 27
  • 34
2

Be sure to use the Mobile Network (not the WiFi) to experience internet speed change on your emulator.

enter image description here

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
1

Run->Run Configurations: there you can find Emulator Launch Parameters where you can set the internet speed

Lavanya
  • 3,903
  • 6
  • 31
  • 57
0

On emulator go to

Extended Controls -> Cellular -> Network Type

and set paramater as your per your requirement

Upendra Shah
  • 2,218
  • 17
  • 27