-->

是否可以解锁SIM卡,让投入pin码软件(Is it possible to unlock the

2019-07-28 19:23发布

I'm要放弃手机(安卓)的客户(主要是儿童),并希望建立一个'lock'-应用。 我不希望客户端与pin码的电话打扰,但是当你打开设备时,'lock'-应用应该只是开始。 然后我覆盖按钮和他们shouldn't能够使电话中。

唯一的一点是,在移除SIM卡的情况下,或者在盗窃的情况下,我要上的卡贴pin码。 那么,这可能是我的'lock'应用程序内解锁通过代码将在管脚SIM卡?

我怎样才能做到这一点?

Answer 1:

这是可能的。 我这样做是在这样的代码:

    try {
        @SuppressWarnings("rawtypes")
        Class clazz = Class.forName(telephonyManager.getClass().getName());
        Method m = clazz.getDeclaredMethod("getITelephony");
        m.setAccessible(true);
        ITelephony it = (ITelephony) m.invoke(telephonyManager);
        if (it.supplyPin("1234")) {
            // SIM unlocked
        } else {
            // not unlocked
        }

    } catch (Exception e) {
        // 
    }

为了做到这一点,你需要的ITelephony接口。 你可以找到它的根源在这里 。 让com.android.internal.telephony包在你的src文件夹,并把iTelephony.java那里。 这种方法使用* android.permission.MODIFY_PHONE_STATE *许可,这是唯一可高达至Android 2.2。 由于2.3版本的权限仅限于系统应用。 如果你想使用最新版本的代码,你有你的应用程序apk文件从移动/数据/应用/系统/应用程序文件夹中。



文章来源: Is it possible to unlock the sim and let the software put in the pincode