IMSI(International Mobile SubscriberIdentification Number)国际移动用户识别码,是区别移动用户的标志,储存在SIM卡中。
SimRecords.java中有API: getIMSI
sergeycao code如下:
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RIL;
private static final int EVENT_GET_IMSI_DONE = 1;
Phone phone;
phone = PhoneFactory.getDefaultPhone();
phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
public void handleMessage(Message msg) {
switch (msg.what)
{
case EVENT_GET_IMSI_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult)msg.obj;
if (ar.exception != null) {
Log.e(LOG_TAG, "Exception querying IMSI, Exception:" + ar.exception);
break;
}
imsi = (String) ar.result;
Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxx");
break;
default:break;
}
}