MCQs > IT & Programming > Android Programming > If you are going to check a network connection with the below source code, what would be required to make it work? public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) return true; return false; }

Android Programming MCQs

If you are going to check a network connection with the below source code, what would be required to make it work? public boolean isOnline() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnectedOrConnecting()) return true; return false; }

Answer

Correct Answer: android.permission.ACCESS_NETWORK_STATE

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Android Programming Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Android Programming Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it