Answer the question
In order to leave comments, you need to log in
How to determine through the application whether there is an Internet or not?
How to determine whether the user is connected to the Internet through the application or not? It is necessary to determine this moment right at the very opening of the application.
Answer the question
In order to leave comments, you need to log in
public boolean isOnline() {
ConnectivityManager cm =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
return netInfo != null && netInfo.isConnectedOrConnecting();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question