facebookarchive / network-connection-class

Listen to current network traffic in the app and categorize the quality of the network.
Other
3.18k stars 515 forks source link

Speed in Mbps #33

Open salbiz opened 7 years ago

salbiz commented 7 years ago

Hi all I am using this library to get the speed in Mbpsin my app. the function getDownloadKBitsPerSecond() resturns me unexpected values. For instance speeds higher than my internet connection even. I am just trying to download an image file as a task .Please help me out with what I am doing wrong or I can get connection speed. I am not using wifi but mobile data instead.

Will appreciate help in advance.

Thanks Sal

erodewald commented 7 years ago

Seeing extremely high Kbits reported by this method, even with the client throttled to 2mbps by a Meraki WAP.

erodewald commented 7 years ago

I got another device to test on and realized the bandwidth figures appeared to be correct. For whatever reason, the numerous identical devices I was testing on (Minix Neo X9) all report woefully embellished figures. I noticed that, when showing the source in Android Studio, it used /proc/net/xt_qtaguid/stats instead of what is currently in source - TrafficStats.

It was my mistake to assume that there had been a release since the changeover.

For the time being, @salbiz, I simply don't call startSampling()/stopSampling(), I just put hold DateTime.now() in fields at the pre/post execute and then manually addBandwidth() using the connection's contentLength. So far it's much more accurate.

@SeyelentEco Can we get an updated release from the latest sources? I'm not 100% sure it fixes the issues I see on this Minix hardware, but it makes sense to release the code you wrote.

Thanks

lsfzlj commented 6 years ago

I got the same problem in HuaWei phone ,I didn't try other phones, the speed was always more than ten Mbps

Zaraki596 commented 5 years ago

I simply don't call startSampling()/stopSampling(), I just put hold DateTime.now() in fields at the pre/post execute and then manually addBandwidth() using the connection's contentLength. So far it's much more accurate.

@erodewald Can you post the example for it, So that beginners can get a clear understanding of what's going on?

ssmerechinskiy commented 5 years ago

Why are send me this letter? I dont relate to it.

пн, 26 авг. 2019 г. в 10:35, Rohan Singh notifications@github.com:

I simply don't call startSampling()/stopSampling(), I just put hold DateTime.now() in fields at the pre/post execute and then manually addBandwidth() using the connection's contentLength. So far it's much more accurate.

Can you post the example for it, So that beginners can get a clear understanding of what's going on?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/facebook/network-connection-class/issues/33?email_source=notifications&email_token=AETIJFSDM54MCPMTZLLYSODQGOBV5A5CNFSM4DJRALKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5DRM4A#issuecomment-524752496, or mute the thread https://github.com/notifications/unsubscribe-auth/AETIJFX45L4KYOK37OZBICDQGOBV5ANCNFSM4DJRALKA .