android当前apn的状态以及获取方法

前端技术 2023/09/10 Android
在绝大多数android机器etc路径下存放一个的apns-conf.xml文件,表示当前机器使用的apn信息通过root机器可以push出来看看,具体路径可以上网搜下
复制代码 代码如下:

static Uri PREFERRED_APN_URI = Uri.parse(\"content://telephony/carriers/preferapn\");
ContentResolver cResolver = context.getContentResolver();
Cursor cr = cResolver.query(PREFERRED_APN_URI, null, null, null, null);
cr.moveToFirst();
String user = cr.getString(cr.getColumnIndex(\"user\"));
String pass = cr.getString(cr.getColumnIndex(\"password\"));
//然后对获取的用户名和密码做相关处理获取对应的apn状态

本文地址:https://www.stayed.cn/item/26587

转载请注明出处。

本站部分内容来源于网络,如侵犯到您的权益,请 联系我

我的博客

人生若只如初见,何事秋风悲画扇。