读书人

检察APN

发布时间: 2012-09-20 09:36:50 作者: rapoo

检查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#;)谢了。

读书人网 >移动开发

热点推荐