facebookarchive / network-connection-class

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

Hi can i get my internet strength as soon as i enter in app without sampling anything #26

Open asuxus opened 8 years ago

sreejithr commented 8 years ago

It calculates the network quality by adding the byte diff between sampling to a moving average. Some traffic has to happen before you can get the quality.

long newBytes = TrafficStats.getTotalRxBytes();
long byteDiff = newBytes - sPreviousBytes;
SeyelentEco commented 8 years ago

So it's not accurate, but I plan on adding a feature to guess the bandwidth based on the type of connection. We know a user on a 2g connection will be POOR and a 3G connection will be MODERATE. We won't be able to tell if WIFI is good or bad, but it's better than nothing.

Look out for a pull request soon.

p-fischer commented 6 years ago

@SeyelentEco Are you still planning to add this feature?