2

I'm using this code to check for network connections:

public boolean isOnline() {
    ConnectivityManager cm =
        (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnectedOrConnecting()) {
        return true;
    }
    return false;
}

it's works fine. but what I want is if internet is available too or not, because sometimes network is available but there is no internet.

user2682025
  • 129
  • 1
  • 3
  • 14

0 Answers0