Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access the SIM Card with an Android Application?

I wonder if it's possible to access to the SIM card with an Android Application

like image 474
Adrien Avatar asked Mar 03 '10 15:03

Adrien


1 Answers

You can get the IMEI like this (but is it what you want ?), just an exemple :

mTelephonyMgr = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String imei = mTelephonyMgr.getDeviceId();

Likewise, you have

String getSimCountryIso():

Returns the ISO country code equivalent for the SIM provider's country code.

String getSimOperator(): Returns the MCC+MNC (mobile country code + mobile network code) of the provider of the SIM.

String getSimOperatorName(): Returns the Service Provider Name (SPN).

String getSimSerialNumber(): Returns the serial number of the SIM, if applicable.

int getSimState(): Returns a constant indicating the state of the device SIM card.

String getSubscriberId(): Returns the unique subscriber ID, for example, the IMSI for a GSM phone.

For more, take a look at this page

and don't forget to add the correct permission in the manifest (getDeviceId() => Requires Permission: READ_PHONE_STATE)

like image 72
Hubert Avatar answered Oct 02 '22 06:10

Hubert