首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

检察APN

2012-09-20 
检查APN/** * 对系统的apn数据库表进行遍历,若没有cmnet则创建改apn,若存在则设置cmnet为当前的apn ** @pa

检查APN

/** * 对系统的apn数据库表进行遍历,若没有cmnet则创建改apn,若存在则设置cmnet为当前的apn *  * @param context **/public static void detectSystemApn(final Context context) {Cursor c = context.getContentResolver().query(APN_TABLE_URI, null,null, null, null);// 检测系统apn,若没有apn则默认添加一个cmnet的apn;if (c == null) {InsertAPN(context, APNNAME, APN);return;}// 遍历系统apn,若存在cmnet apn 设置cmnet为当前的apnif (c.moveToFirst()) {do {String row = "";int i = c.getColumnIndex("name");row += c.getString(i);if (row.equals("CMNET")) {// 获得 cmnet apn的idint apn_id = Integer.parseInt(c.getString(c.getColumnIndex("_id")));c.close();// 修改apn设置// updateApn(context,apn_id);// 设置cment为当前的apnSetNowAPN(context, apn_id);return;// return true;}} while (c.moveToNext());}c.close();// 遍历系统apn,不存在cmnet apn 添加一个cmnet的apnInsertAPN(context, APNNAME, APN);}

?

1 楼 zql2005110 2011-07-13   你好!请问你如何判断当前网络的apn,以及切换apn,(windows mobile ;c#;)谢了。

热点排行