KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to check Internet connectivity on Android using the following method. I have a Wi-Fi connection. private boolean checkInternetConnection() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); // Test for connection if (cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isAvailable() && cm.getActiveNetworkInfo().isConnected()) { return true; } else { // No conection return false; } } I disconnect my PC from the Internet and then try to run the above method. Still it always returns true!? Why?
Tags (comma-separated)
Save Edits
Cancel