How to Measure Upload/Download Speed and Latency in Android Wifi Connection

Android how to get the wifi downloading and uploading speed for every minute ?

the only way to get download / upload speed is to download / upload something. You cannot calculate it from signal level or similar. This is mainly due to throughput being affected by a lot more than just signal strength (e.g. how busy is the wifi router, how fast is its net connection, how fast is the server, how fast is every component between the wifi router and the server, etc)

In short - you'll have to download / upload something (preferably something big enough that that you can average several readings to get an accurate result)

Edit: if you are wanting the theoretical speed of the wifi connection (e.g. the nominal speed for an a/b/g/n type connection) then I'm not sure - I don't think there was a standard interface for getting the connection mode from the wifi...

Android : How to get internet connection upload speed and latency?

I followed this link and got the almost correct download speed. And for upload speed I created a PHP api, uploaded it to FTP server and called it from device and uploaded a file. Then I calculate the time before uploading and after uploading to get Upload Speed.

Android: How to determine Network speed in android programmatically

Determining your Network Speed - (Slow Internet Speed)

Using NetworkInfo class, ConnectivityManager and TelephonyManager to determine your Network Type.

Download any file from the internet & calculate how long it took vs number of bytes in the file. ( Only possible way to determine Speed Check )

I have tried the below Logic for my projects, You have also look into this, Hope it helps you.

ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
//should check null because in airplane mode it will be null
NetworkCapabilities nc = cm.getNetworkCapabilities(cm.getActiveNetwork());
int downSpeed = nc.getLinkDownstreamBandwidthKbps();
int upSpeed = nc.getLinkUpstreamBandwidthKbps();

Simulate low network connectivity for Android

You can use emulator for this. Take a look at this page: Android Emulator. Pay attention to next two arguments:

  1. -netdelay <delay>

    Set network latency emulation to . Default value is none. See
    the table in Network Delay Emulation for supported values.

  2. -netspeed <speed>

    Set network speed emulation to . Default value is full. See
    the table in Network Speed Emulation for supported values.

    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 ∞ ∞

How to limit speed of internet connection on Android emulator?

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)



Related Topics



Leave a reply



Submit