1

connectivitymanager.getActiveNetworkInfo() returning true when Internet is off (Android)?

view story
linux-howto

http://stackoverflow.com – This is the code I am using to determine if the phone is connected to the Internet: public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) { return true; } return false; } On an emulator, this is returning true even when I turn my computer's Wi-Fi off. I see a 3G sign on the topmost bar of the emulator, even when the computer is off the Internet. Is there something wrong with (HowTos)