0
点赞
收藏
分享

微信扫一扫

android 如何获取IMSI号


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;

}

}

举报

相关推荐

0 条评论