2

I am working on a project . I need to find out the download and upload speed per second ... So far i have find out the transmitted and received total bytes. Any help will be much appreciated. Here is my code..

    mStartRX = TrafficStats.getTotalRxBytes();
    mStartTX = TrafficStats.getTotalTxBytes();

    if (mStartRX != TrafficStats.UNSUPPORTED
            && mStartTX != TrafficStats.UNSUPPORTED) {

        mIsStatSupported = true;
    } 

        long rxBytes = TrafficStats.getTotalRxBytes() - mStartRX;
        txtRX.setText(Long.toString(rxBytes) + " bytes");
        long txBytes = TrafficStats.getTotalTxBytes() - mStartTX;
        txtTX.setText(Long.toString(txBytes) + " bytes");
        int linkSpeed = mWifi.getConnectionInfo().getRssi();
        txtWifi.setText(String.valueOf(linkSpeed) + " dBm"); 
Autul
  • 21
  • 2
  • I have found the solution i wanted from this link...http://stackoverflow.com/questions/5193518/how-to-measure-upload-download-speed-and-latency-in-android-wifi-connection ... – Autul Aug 24 '14 at 09:31

0 Answers0