0

I am developing an application that displays internet speed. like: https://play.google.com/store/apps/details?id=netspeed.pt

https://play.google.com/store/apps/details?id=com.internet.speed.meter.lite&hl=en

I have to gain WiFi speed at any moment, I used the runnable:

WifiManager wm = (WifiManager)getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInfo = wm.getConnectionInfo();
....

runnable = new Runnable() {

    @Override
    public void run() {

        int linkSpeed = wifiInfo.getLinkSpeed();
        chatHead.setText( "Speed : " + linkSpeed);
        handler.postDelayed(runnable,100); 

    }
};

handler.postDelayed(runnable,100); 

But speed does not changes , even when downloading. I'm a little confused!

I have access to the Internet at any given moment, what can I do? Should be used from native code? Or Java code as well?

Please help me.

Kaushik
  • 6,150
  • 5
  • 39
  • 54
user3720045
  • 33
  • 2
  • 4
  • Without looking at the details, the speed returned may be a theoretical maximum with no accounting for signal quality, loss or congestion, and it may not be the wifi which is the bottleneck in your download speed. – Chris Stratton Oct 31 '14 at 07:53

1 Answers1

1

The link speed is the maximum protocol speed between your device and the wifi base station.

If you want to measure actual amount of data transferred over a time period, have a look at TrafficStats.

laalto
  • 150,114
  • 66
  • 286
  • 303