Is it possible to unlock the simulator and let the software fit in pincode

I am going to give phones (Android) to clients (mainly children) and want to create a lock application. I don’t want customers to worry about pincode for the phone, but when you turn on the device, the “lock” application should only begin. Then I overwrite the buttons and they should not create music libraries.

The only thing, in case of removal of the sim, or in the case of theft, I want to use the PIN code on the SIM card. So is it possible that my “blocking” application unlocks the sim by inserting a pin on the code?

How can i do this?

+1
source share
1 answer

It is possible. I do this in this code:

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) { // } 

For this, you will need the ITelephony interface. Here you can find its source. Make the com.android.internal.telephony package in your src folder and put iTelephony.java. This approach uses the * android.permission.MODIFY_PHONE_STATE * permission, available only for Android 2.2. Starting with version 2.3, this permission is limited by system applications. If you want to use this code in the latest version, you need to transfer the apk file of the application from / data / app to the / system / app folder.

+5
source

Source: https://habr.com/ru/post/957460/


All Articles