private boolean needSetProxy(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mobNetInfo = connectivityManager.getActiveNetworkInfo();
if (mobNetInfo == null || "WIFI".equals(mobNetInfo.getTypeName())) {
return false;
}
if (mobNetInfo.getSubtypeName().toLowerCase().contains("cdma")) {
// 电信网络
if (Proxy.getDefaultHost() != null
&& Proxy.getDefaultPort() != -1) {
return true;
}
} else if (mobNetInfo.getExtraInfo().contains("wap")) {
// 移动或联通网络
return true;
}
return false;
}