wifi나 인터넷연결 확인

ConnectivityManager manager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);

NetworkInfo mobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); NetworkInfo wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
// wifi 또는 모바일 네트워크 어느 하나라도 연결이 되어있다면,

if (wifi.isConnected() || mobile.isConnected()) { Log.i(“연결됨” , “연결이 되었습니다.); setContentView(R.layout.activity_logo); } else { Log.i(“연결 안 됨” , “연결이 다시 한번 확인해주세요); }



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s