检查网络是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; }
更多精彩
赞助商链接