Detecting Network Speed and Type on Android (Edge,3G)

For better experience for users of my app I wanted to show them different UI based on their network speed, problem here is that there is no way to know what network we are currently on.

My first instinct was to use getActiveNetworkInfo() which gives us current network information, but the only thing we can find out from this is the connection type TYPE_MOBILE or TYPE_WIFI which is not very useful for my purpose.

So here is a quick tool that will try to determine network type by testing the download speed, I use threshold of 176 kbits/sec as EDGE cut of value.



14 thoughts on “Detecting Network Speed and Type on Android (Edge,3G)”

  1. Hey, the result is different from that of app. I put a 10M bytes file on an instance in Amazon EC2. the result of this app is at most 2.9 Mbps instead of about 5Mbps of app

  2. Rahul Chandrabhan

    Can you post a code from which i can get upload speed ….plzzzz
    it would help me a lot because i stuck on my office project.

  3. Pingback: Show Network Speed Android | andorid best

  4. APK file showing nothing but crashing after some time.
    Source code looks good. You made my day.
    Here someone is saying wifiInfo.getLinkSpeed(); but that was wrong because getLinkSpeed gives maximum capacity of your wifi link.

    1. If you know that your download speed is 1 Megabyte per second then this is equivalent to 8 Megabits per second. To find out how the download speed is calculated a look at the source.
      Typical steps are as follow

      • Download file from know location with know size
      • Time the download
      • Caluclate number of bytes recived during the time
      • display results

Leave a Comment

Your email address will not be published. Required fields are marked *