从代码[root]读取当前的APN名称 [英] Read current APN name from code [root]
问题描述
我需要能够读取当前的APN名称.我的应用程序是系统应用程序(位于/system/app下),并且具有root用户访问权限.
I need to be able to read current APN name. My app is a system app (it's located under /system/app) and I have root access.
我正在尝试获取APN名称,但这是不可能的,因为总是提示我:
I'm trying to get APN name but it's being impossible because I'm always prompted with:
No permission to write APN settings
我还在Android Manifest中添加了以下权限
I also have added the following permissions in Android Manifest
<uses-permission android:name="android.permission.WRITE_APN_SETTINGS"/>
TARGET SDK> 18(棒棒糖)
非常感谢.
推荐答案
Android 5.1 introduced Carrier Privileges (https://source.android.com/devices/tech/config/uicc).
要更改APN,您必须使用与SIM卡相同的签名对应用程序进行签名.如果执行此操作,则可以更改APN.您不需要
To be possible to change the APN you have to sign your app with the same signature of the SIM card. If you do this, then it is possible to change the APN. You do not need the
<uses-permission android:name="android.permission.WRITE_APN_SETTINGS"/>
在Android清单中.
in Android Manifest.
例如,您可以使用Android Studio签名您的应用程序( https://developer.android.com/studio/publish/app-signing.html )
You can sign your app with Android Studio for example (https://developer.android.com/studio/publish/app-signing.html)
这篇关于从代码[root]读取当前的APN名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!