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

always showing internet quality POOR #35

Open sssvrock opened 7 years ago

sssvrock commented 7 years ago

DeviceBandwidthSampler.getInstance().startSampling(); // Calling API network operation and after success or error from volley response DeviceBandwidthSampler.getInstance().stopSampling(); mUtils.showInternetQualityIfPoor(); // Now checking bandwidth and showing message

even though when I was in Very god internet quality, it is always showing POOR connection, help me out how can I modify to get exact connection quality

Regards Vinod

mousetraps commented 7 years ago

@sssvrock what does your network operation do? According to the README, "The library does this by listening to the existing internet traffic done by your app and notifying you when the user's connection quality changes." So if you're not downloading much data in between starting/stopping the sampling, it's going to always report a poor connection.

You can see the default values here: https://github.com/facebook/network-connection-class/blob/master/connectionclass/src/main/java/com/facebook/network/connectionclass/ConnectionClassManager.java#L35-L37

If you're trying to do a generic measurement of network quality, you'll have to ramp up your download operations to the max during the sampling period.