Code example for NetworkInfo

Methods: getExtraInfo, isAvailable

0
		 
		String str = null;
		ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 
	    NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
	    if (activeNetInfo != null ){ // ע�⣬����ж�һ��Ҫ��Ŷ��Ҫ��Ȼ�����
        	if(activeNetInfo.isAvailable()){
//        		if("cmwap".equals(activeNetInfo.getExtraInfo())){ 
//        			b = false; 
//        		}else{ 
//        			b = true; 
//        		} 
        		if(activeNetInfo.getExtraInfo()==null){
        			return "wifi"; 
        		} 
        		return activeNetInfo.getExtraInfo();
        	} 
        } 
	    return str;
//	    if(activeNetInfo==null){ 
//	    	return false; 
//	    }else{