Apn的读写

Device: rk3188
Platform Version: Android 4.4

分为以下两个步骤

  1. Apn读取
  2. Apn写入

Apn读取

apns-conf.xml—>telephony.db

  1. apns-conf.xml放在system/etc/

  2. telephony.db放在data/data/com.android.providers.telephony/databases/下如果找不到可以用find在/data/下查找

  3. 第一次开机时将apns-conf.xml中apn信息加载进telephony.db,后面再次开机不会再加载,除非apn-conf.xml被更新并升级或者telephony.db被删除了。

  4. 如果想增加可以将新的apn加进apn-conf.xml,并删除telephony.db,然后reboot就可以了。

  5. 打开4G的时候读取sim卡的mcc和mnc去telephony.db,成功并在APN页显示出来

    private static final String PREFERRED_APN_URI = "content://telephony/carriers/preferapn";
    private static final Uri PREFERAPN_URI = Uri.parse(PREFERRED_APN_URI);
    Cursor cursor = mContext.getContentResolver()
                .query(PREFERAPN_URI, null, null, null, null);
    

Apn写入

Uri uri = mContext.getContentResolver().insert(Telephony.Carriers.CONTENT_URI, values);
        long insertId = ContentUris.parseId(uri);
        ContentValues preferValues = new ContentValues();
        preferValues.put(APN_ID, insertId);
        mContext.getContentResolver().update(PREFERAPN_URI, preferValues, null, null);

转载请注明出处:http://www.wolfnx.com/2017/11/12/Apn

作者 : wolfnx
邮箱 : wolfnx@outlook.com
邮箱2 : lostnx@gmail.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值