bboks.net™

안드로이드 네트워크 상태 확인 본문

Mobile Programming/Android

안드로이드 네트워크 상태 확인

bboks.net 2014. 8. 18. 17:01
boolean isNetworkConnectionAvailable() {
	ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
	NetworkInfo info = cm.getActiveNetworkInfo();
	if (info == null)
		return false;
	State network = info.getState();
	return (network == NetworkInfo.State.CONNECTED || network == NetworkInfo.State.CONNECTING);
}


[출처] How to check the network availability?