Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check SIM lock on Android application level

Tags:

android

I'm looking for a way to find out if an android device is SIM locked or not. I know that in /efs/ should be a file where this setting is stored at. The problem is that without root there's no access to /efs/.

USSD codes like ##7465625# does no more work for Android 4.1.2 on Samsung devices.

So does anybody know how I can figure out if there's a SIM lock enabled?

Thanks, tom

like image 829
tomhofer.com Avatar asked Nov 25 '22 07:11

tomhofer.com


1 Answers

Assuming we're talking about the same kind of Sim Lock, you can check SIM Lock and a variety of other things using the Telephony Manager.

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

int simState = telephonyManager.getSimState();

if (simState == TelephonyManager.SIM_STATE_NETWORK_LOCKED) {
    //do something
}
like image 184
Sean O'Toole Avatar answered Dec 22 '22 23:12

Sean O'Toole