WEB开发网
开发学院软件开发Java 检查网络是3G WIFI或WAP 阅读

检查网络是3G WIFI或WAP

 2012-05-16 10:15:19 来源:WEB开发网   
核心提示:public void getNetworkType(Context context){ConnectivityManager conn = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);if(conn.getNe
public void getNetworkType(Context context){
		ConnectivityManager conn = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		
		if(conn.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() ==  NetworkInfo.State.CONNECTED){
			//TODO WIFI;
		}else if(conn.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() ==  NetworkInfo.State.CONNECTED){
			String proxyHost = android.net.Proxy.getDefaultHost();
	        if (proxyHost != null && !proxyHost.equals("")) {
	        	//TODO WAP
	        }
			//TODO GPRS;
		}
		//NO_NETWORK;
	}

Tags:检查 网络 WIFI

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接