开发者

Retrieving SIM ID

开发者 https://www.devze.com 2023-01-26 07:34 出处:网络
After searching the API and no luck, mybe anyone开发者_JAVA百科 know howcould I retrieve the SIM ID of the device?

After searching the API and no luck, mybe anyone开发者_JAVA百科 know how could I retrieve the SIM ID of the device?

thanks,

ray.


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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消