Answer the question
In order to leave comments, you need to log in
How to show splash-screen if there is no internet on iOS, Android, WP?
Hello,
there are three applications that crash if there is no internet. How can I handle the lack of Internet with a splash screen for three platforms?
Maybe there is some kind of dock, guide, documentation about it?
Answer the question
In order to leave comments, you need to log in
public class NetworkManager {
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
return true;
} else {
return false;
}
}
}
if (NetworkManager.isNetworkAvailable(context)) {
// делаем спокойно запрос например
} else {
// если сети нет показываем Тост или
// кидаем на активити с красивым дизайном где просим сделать реконнект
}
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Do you need documentation for checking your internet connection?
Each platform has its own way.
Write to Google how to check internet access android / ios / wp and get the solution with the first link.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question