반응형

ConnectivityManager manager =
            (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo mobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
    NetworkInfo wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
     
    if (mobile.isConnected() || wifi.isConnected()) {
        // Connected 연결됨
         
        return true;
    } else {
        // Disconnect 연결 안됨
        Dialog dialog = new Dialog(getBaseContext());
        dialog.setContentView(R.layout.internet);
        return false;
    }


반응형
,