android获取当前接入点信息判断是ctwap还是ctnet实例代码
更新时间:2013年11月29日 14:47:32 作者:
这篇文章主要介绍了android获取当前接入点信息判断是ctwap还是ctnet的方法,大家参考使用吧
复制代码 代码如下:
/**
* 获取当前的接入点是ctwap还是ctnet
* @author <a href="mailto:yejiurui@126.com">yejiurui</a>
* @version 1.0 2013-5-17 下午5:46:05 2013
*/
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 Jetpack架构中ViewModel接口暴露的不合理探究
这篇文章主要介绍了Android Jetpack架构组件 ViewModel详解,ViewModel类让数据可在发生屏幕旋转等配置更改后继续存在,ViewModel类旨在以注重生命周期的方式存储和管理界面相关的数据。感兴趣可以来学习一下2022-07-07
最新评论