修改文件/packages/providers/TelephonyProvider/src/com/android/providers/telephony/TelephonyProvider.java
添加一个插入默认apn数据的方法
private void insertAddDefaultApns(SQLiteDatabase db)
{
ContentValues values = null;
for (int i = 0; i < APN_NAMES.length; i++)
{
values = new ContentValues();
String mcc = "460";
String mnc = "00";
String proxy = "";
String port = "";
String server = "";
String mmsProxy = "";
String mmsPort = "";
String mmsC = "";
if (APN_NAMES[i].equals("CMWAP"))
{
mmsProxy = "10.0.0.172";
mmsPort = "80";
mmsC = "http://mmsc.monternet.com";
proxy = "10.0.0.172";
port = "80";
}
String numeric = mcc + mnc;
values.put(Telephony.Carriers.NUMERIC,numeric);
values.put(Telephony.Carriers.MCC, mcc);
values.put(Telephony.Carriers.MNC, mnc);
values.put(Telephony.Carriers.NAME, APN_NAMES[i]);
values.put(Telephony.Carriers.APN, APN_APNS[i]);
values.put(Telephony.Carriers.USER, "");
values.put(Telephony.Carriers.SERVER, server);
values.put(Telephony.Carriers.MMSPROXY, mmsProxy);
values.put(Telephony.Carriers.MMSPORT, mmsPort);
values.put(Telephony.Carriers.MMSC, mmsC);
values.put(Telephony.Carriers.PROXY, proxy);
values.put(Telephony.Carriers.PORT, port);
values.put(Telephony.Carriers.PASSWORD, "");
values.put(Telephony.Carriers.TYPE, APN_APNTYPES[i]);
values.put(Telephony.Carriers.AUTH_TYPE, "None");
insertAddingDefaults(db, CARRIERS_TABLE, values);
}
}
在initDatabase方法中调用它