Android:No permission to write APN settings(沒有写入 APN 设置的权限)
16lz
2021-01-23
如果你想读Android 4.2以及以上版本的APN,我觉得你改变一下方法即可。我试了,而且可以实现。
在Android 4.1 以及以下版本 :
Cursor c = getContentResolver().query(Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"), null, null, null, null);
在Android 4.2 以及以上版本:
private static final String[] APN_PROJECTION = {Telephony.Carriers.TYPE, // 0
Telephony.Carriers.MMSC, // 1
Telephony.Carriers.MMSPROXY, // 2
Telephony.Carriers.MMSPORT // 3
};
并且加上这一句:
final Cursor apnCursor =SqliteWrapper.query(context, this.context.getContentResolver(), Uri.withAppendedPath(Carriers.CONTENT_URI, "current"), APN_PROJECTION, null, null, null);
在开头写一句导入语句:
import android.database.sqlite.SqliteWrapper;
转载地址:http://stackoverflow.com/questions/13453640/read-apns-in-android-4-2
更多相关文章
- Android官方使低版本系统(2.1)支持ActionBar的方法
- 【Android】Android2.3版本以上谷歌为何推荐使用HttpURLConnecti
- Android SDK目录及版本号区别
- Android API对应版本关系(最新更新2019年10月)
- Android使用Bugly实现APP版本更新
- android:minSdkVersion 版本 标示
- Android app“版本更新”功能的前后端实现