Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onStart() {
- cd = new ConnectionDetector(getApplicationContext());
- //Получаем статус Интернет
- isInternetPresent = cd.ConnectingToInternet();
- //Проверяем Интернет статус:
- if (!isInternetPresent) {
- showAlertDialog(LoginActivity.this, "Интернет соединение отсутствует",
- "У вас нет Интернет соединения", false);
- }
- super.onStart();
- }
- public boolean networkIsConnected() {
- ConnectivityManager connectivity = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo networkInfo = connectivity != null ? connectivity.getActiveNetworkInfo() : null;
- return ((networkInfo != null) && networkInfo.isConnected());
- }
Add Comment
Please, Sign In to add comment