Access the SIM Card with an Android Application?
Asked Answered
A

6

14

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

Armitage answered 3/3, 2010 at 15:57 Comment(3)
You need to ask much more specific questions. What is it about the SIM card that you want to access?Unlearned
Probably "exchange arbitrary APDU-s" is what he wants.Haag
I want to cimmunicate with a javacard application with APDu or BIP protocolArmitage
E
9

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)

Elizbeth answered 3/3, 2010 at 18:16 Comment(4)
IMEI is associated with the phone device, not the SIM card.Haag
But Can I send APDU command to the SIM Card to communicate with a javacard application?Armitage
This is an SmartCard Communication Framework, which doesn't let you change the telephonenumber.Alita
can i get the scaddress for SMSManager using it?Lewellen
L
5

Without SmartCardAPI from SEEK(Secure Element Evaluation Kit) its never possible. In majority Android phones available in market SmartCardAPI is not implemented. So either you build your own Android after integrating the SmartCardAPI code or wait for some decent phone with this feature to come out. You can find the patch file for implementation here.

Lovins answered 3/3, 2010 at 15:57 Comment(0)
O
4

SmartCard API for Android might be of interest for you: http://code.google.com/p/seek-for-android/

Orate answered 29/12, 2010 at 15:48 Comment(1)
Does this app allow you to change MSISDN (phone number) on Android smartphone?Photocompose
R
2

SIM card access is only possible for system applications:

Low level access to the SIM card is not available to third-party apps. The OS handles all communications with the SIM card including access to personal information (contacts) on the SIM card memory. Applications also cannot access AT commands, as these are managed exclusively by the Radio Interface Layer (RIL). The RIL provides no high level APIs for these commands.

source: https://source.android.com/security/overview/app-security.html#sim-card-access

Roadblock answered 18/7, 2012 at 11:52 Comment(1)
Updated link: source.android.com/security/overview/…Leonilaleonine
L
0

SEEK is most useful one,but majority Android phones are not support that.So,maybe we can assess SIM card by some other method like read SMS(in SIM card).

Lubumbashi answered 28/2, 2014 at 3:14 Comment(1)
Hi can you please provide more explanation?Drin
F
0

You should use IccFileHandler in interal api of android using java reflection . It is located at framework/base/telephony

Fermentation answered 17/7, 2017 at 4:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.