private String CTWAP="ctwap";
private String CTNET="ctnet";
private Uri PREFERRED_APN_URI = Uri
.parse("content://telephony/carriers/preferapn");
public String getApnType(Context context) {
String apntype = "nomatch";
Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null,
null, null, null);
c.moveToFirst();
String user = c.getString(c.getColumnIndex("apn"));
if (user.startsWith(CTNET)) {
apntype = CTNET;
} else if (user.startsWith(CTWAP)) {
apntype = CTWAP;
}
return apntype;
}
您可能感兴趣的文章:Android 关于“NetworkOnMainThreadException”问题的原因分析及解决办法Caused by: android.os.NetworkOnMainThreadException错误解决办法Android之IphoneTreeView带组指示器的ExpandableListView效果asp.net 通过UserAgent判断智能设备(Android,IOS)Android 系统net和wap接入点的区别