Guest User

Untitled

a guest
Aug 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. @Override
  2. protected void onStart() {
  3. cd = new ConnectionDetector(getApplicationContext());
  4. //Получаем статус Интернет
  5. isInternetPresent = cd.ConnectingToInternet();
  6.  
  7. //Проверяем Интернет статус:
  8. if (!isInternetPresent) {
  9. showAlertDialog(LoginActivity.this, "Интернет соединение отсутствует",
  10. "У вас нет Интернет соединения", false);
  11. }
  12. super.onStart();
  13. }
  14.  
  15. public boolean networkIsConnected() {
  16. ConnectivityManager connectivity = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
  17. NetworkInfo networkInfo = connectivity != null ? connectivity.getActiveNetworkInfo() : null;
  18. return ((networkInfo != null) && networkInfo.isConnected());
  19. }
Add Comment
Please, Sign In to add comment