Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving SIM ID

Tags:

android

After searching the API and no luck, mybe anyone know how could I retrieve the SIM ID of the device?

thanks,

ray.

like image 502
rayman Avatar asked Oct 29 '25 14:10

rayman


2 Answers

Here is the code to get International Mobile Subscriber Identity (IMSI No.) id and phone id (IMEI No.) and Sim No. programmatically

Before doing this also set the user permission in the manifest file "android.permission.READ_PHONE_STATE"

    TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    String imsi = mTelephonyMgr.getSubscriberId();
    String imei = mTelephonyMgr.getDeviceId(); 
    String simno = mTelephonyMgr.getSimSerialNumber();
    Log.v("", ""+imsi);
    Log.v("", ""+imei);
    Log.v("", ""+simno);
like image 86
Sumit Sharma Avatar answered Oct 31 '25 04:10

Sumit Sharma


Frrom wikiPedia

The Id = Issuer identification number (IIN) Maximum of seven digits: Major industry identifier (MII), 2 digits, 89 for telecommunication purposes. Country code, 1-3 digits, as defined by ITU-T recommendation E.164. Issuer identifier, 1-4 digits.

so the API is :

public String getSimCountryIso ()
public String getSimSerialNumber ()
public String getSubscriberId ()
like image 40
Preet Sangha Avatar answered Oct 31 '25 04:10

Preet Sangha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!