Simulate slow network on Android simulator

I’m building an app that uses AsyncTask to display a progress bar when it’s performing network operation (Google translate).
However, the problem is that I can’t tell if it’s working since the network is too fast and it finishes running the operation as soon as I start it.
So is there a way to simulate a slow network so that I can tell if the progress bar will actually run (visible) when it’s waiting for the operation to be completed? I have come across network options when creating an Android emulator. However, there are so many abbreviations that I still have trouble understanding what indicates slow network connection and I’m still not sure if that is how I should set a slow network connection.

Thanks in advance!

  • Is custom enum Serializable too?
  • Getting Year, Month and Date in Android
  • seeing a web server over a socket . . .
  • Pick a directory/file using Intent.ACTION_CREATE_DOCUMENT (Storage Access Framework)
  • How do I fix this Android memory leak involving Threads?
  • How AppBarLayout.ScrollingViewBehavior's math works?
  • Related posts:

    Creating a “favorite” feature on a list of questions that get randomized
    Unable to resolve target 'android-8' after importing libraries
    RuntimeException while using new TextInputLayout from support design library
    What are iml files in Android Studio?
    How to set Font for TextView in android?
    how to send value through intent after finishing an activity
  • Android Intent for Capturing both Images and Videos?
  • Google Play Services with AdMob. Check availability?
  • How to get primary color of material theme in xml drawable?
  • Enable C++11 support on Android
  • How to upgrade/downgrade subscriptions in Android InAppBilling?
  • How can I add a new phone calendar to Android?
  • 3 Solutions collect form web for “Simulate slow network on Android simulator”

    The emulator lets you simulate various network conditions. You can approximate the network speed for different network protocols, or you can specify Full, which transfers data as quickly as your computer allows.

    Specifying a network protocol is always slower than Full. You can also specify the voice and data network status, such as roaming. The defaults are set in the AVD.

    Select a Network type:

    • GSM – Global System for Mobile Communications
    • HSCSD – High-Speed Circuit-Switched Data
    • GPRS – Generic Packet Radio Service
    • EDGE – Enhanced Data rates for GSM Evolution
    • UMTS – Universal Mobile Telecommunications System
    • HSPDA – High-Speed Downlink Packet Access
    • Full (default)

    GPRS(114Kbps) < EGDE(368Kbps) < 3G(3.1Mbps) < HSDPA(14Mbps) < HSPA+(168Mbps) < 4G/LTE(299.6Mbps)

    Select a Voice status, Data status, or both:

    • Home (default)
    • Roaming
    • Searching
    • Denied (emergency calls only)
    • Unregistered (off)

    For more information see https://developer.android.com/studio/run/emulator.html#extended

    In OS X you can use Network Link Conditioner, very useful. Here is a link how to use it and how to install. It will affect all programs using network.

    http://nshipster.com/network-link-conditioner/
    enter image description here

    Also you can send all traffic to proxy and use throttling. I used Charles (Commercial, 30 days free trial)
    https://www.charlesproxy.com/

    With telnet on the command line you can connect to your emulator and change the device’s network speed.

    telnet localhost <<port of device>>
    network speed <<network speed, ex: edge, full>>
    

    You can get the port for the device from the top of the window of the emulator.

    You can use any of the speeds in the android docs here. Id recommend edge for slow speeds

    If you are on windows you will have to setup telnet, you can find directions to do so in this SO post.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.