I'm creating an application in Android in which checks the Internet connectivity. I want to display a toast message when the Internet connection is very slow. Or when the server does not respond to a request. In this case I want to put a toast like Connection is slow !!!. Here in my code I have found the whether the internet is connected or not, but don't know how to toast the message of internet slow...
public boolean isConnectingToInternet(){
ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null)
{
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED)
{
return true;
}
}
return false;
}
Why is the internet so slow on my phone? A slow data connection on your phone is usually caused by a poor connection in your location, network congestion, or too many background apps running.
The main reason phones slow down over time is because new operating updates leave older phones behind. Likewise, internet browsing apps update to sync with newer, better phones. If you don't have the latest and greatest, your phone could struggle with the newest operating system and app updates.
Now , you have to get speed and put condition whether below 100kbps , "low internet connection"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With