Yazan Khateeb
Yazan Khateeb

Reputation: 61

networkInfo.isConnected() method return true even there is no internet?

my app

i develop this app , in the main activity i check the internet connection as the following :

ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

    if (networkInfo != null && networkInfo.isConnected()) {
        LoaderManager loaderManager = getSupportLoaderManager();
        loaderManager.initLoader(1, null, this);

    }

when i go to HOURLY activity i check the internet in the same way like above on the onCreate() method.

my question when i open the main activity i disconnect the internet and go to HOURLY activity to handle "no internet exception" but networkInfo.isConnected() in HOURLY activity return true why the internet still connect???

Upvotes: 1

Views: 1093

Answers (0)

Related Questions