Android App2014.05.26 11:17

AndroidManifest.xml에 아래를 추가

 

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

 

 

주석은 그냥 참고~

 

private boolean IsWifiConnected() {
     ConnectivityManager connManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
     //NetworkInfo state_3g = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
     NetworkInfo state_wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    
     if(state_wifi.isConnected() == true)
      return true;    
     else
      return false;
    
     //return state_3g.isConnected() || state_wifi.isConnected();
 }
 

 

Posted by 동동(이재동)

댓글을 달아 주세요