How to show a slow internet connection to the user when the network is connected Note: Not a network type (2G,3G,4G, WIFI)
UPDATE - DEPRECATED LIBRARY - no longer mainteined
original post:
You can use Network Connection Class by Facebook.
Its ConnectionClassStateChangeListener has a method called onBandwidthStateChange that returns an instance of ConnectionQuality class:
public interface ConnectionClassStateChangeListener {
public void onBandwidthStateChange(ConnectionQuality bandwidthState);
}
ConnectionQuality class is an enum class defined as below:
public enum ConnectionQuality {
/**
* Bandwidth under 150 kbps.
*/
POOR,
/**
* Bandwidth between 150 and 550 kbps.
*/
MODERATE,
/**
* Bandwidth between 550 and 2000 kbps.
*/
GOOD,
/**
* EXCELLENT - Bandwidth over 2000 kbps.
*/
EXCELLENT,
/**
* Placeholder for unknown bandwidth. This is the initial value and will stay at this value
* if a bandwidth cannot be accurately found.
*/
UNKNOWN
}