Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
454 views
in Technique[技术] by (71.8m points)

smartcard - Access the SIM Card with an Android Application?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...