rayman
rayman

Reputation: 21616

Retrieving SIM ID

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

thanks,

ray.

Upvotes: 4

Views: 15836

Answers (3)

Sumit Sharma
Sumit Sharma

Reputation: 1867

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);

Upvotes: 7

Preet Sangha
Preet Sangha

Reputation: 65555

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 ()

Upvotes: 3

adamk
adamk

Reputation: 46844

To retrieve the IMSI (subscriber ID in the SIM), Use the getSubscriberId method in the TelephonyManager API.

Upvotes: 2

Related Questions