public boolean checkNetwokState() {
ConnectivityManager manager =
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
NetworkInfo wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo lte_4g = manager.getNetworkInfo(ConnectivityManager.TYPE_WIMAX); //LTE
boolean blte_4g = false;
if(lte_4g != null)
blte_4g = lte_4g.isConnected();
if (mobile.isConnected() || wifi.isConnected() || blte_4g)
return true;
else {
AlertDialog.Builder dlg = new AlertDialog.Builder(IntroActivity.this);
dlg.setTitle("네트워크 오류");
dlg.setMessage("네트워크 상태를 확인해 주십시요.");
dlg.setIcon(R.drawable.icon36);
dlg.setNegativeButton("종료", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
finish(); // 끝내버렷
}
});
dlg.setCancelable(false);
dlg.show();
return false;
}
}
ConnectivityManager manager =
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
NetworkInfo wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
NetworkInfo lte_4g = manager.getNetworkInfo(ConnectivityManager.TYPE_WIMAX); //LTE
boolean blte_4g = false;
if(lte_4g != null)
blte_4g = lte_4g.isConnected();
if (mobile.isConnected() || wifi.isConnected() || blte_4g)
return true;
else {
AlertDialog.Builder dlg = new AlertDialog.Builder(IntroActivity.this);
dlg.setTitle("네트워크 오류");
dlg.setMessage("네트워크 상태를 확인해 주십시요.");
dlg.setIcon(R.drawable.icon36);
dlg.setNegativeButton("종료", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
finish(); // 끝내버렷
}
});
dlg.setCancelable(false);
dlg.show();
return false;
}
}