Android IMEI混淆“双卡设备”

时间:2013-06-17 10:31:58

标签: android

我使用下面的代码来获取Android设备的IMEI,

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

        IMEI = tm.getDeviceId();

对于具有单个SIM卡活动的设备来说很好。如果我们为具有两张SIM卡的设备应用相同的代码,那么如何获取DeviceID并告诉我是否有SIM1 Id或SIM2 Id?

2 个答案:

答案 0 :(得分:2)

IMEI号码应该与手机相关联,而不是与SIM卡相关联,因此在双SIM卡设备中,您应该只有一个IMEI号码。

“IMEI仅用于识别设备”[...]“而是通过传输IMSI号码来识别用户,该号码存储在SIM卡上” - 参考:Wikipedia < / p>


编辑:

检查源代码,也许你可以找到一些提示:Source of Settings app

这里是“IMEI”部分的片段:

// NOTE "imei" is the "Device ID" since it represents
        // the IMEI in GSM and the MEID in CDMA
        if (mPhone.getPhoneName().equals("CDMA")) {
            setSummaryText(KEY_MEID_NUMBER, mPhone.getMeid());
            setSummaryText(KEY_MIN_NUMBER, mPhone.getCdmaMin());
            if (getResources().getBoolean(R.bool.config_msid_enable)) {
                findPreference(KEY_MIN_NUMBER).setTitle(R.string.status_msid_number);
            }
            setSummaryText(KEY_PRL_VERSION, mPhone.getCdmaPrlVersion());
            removePreferenceFromScreen(KEY_IMEI_SV);

            if (mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
                // Show ICC ID and IMEI for LTE device
                setSummaryText(KEY_ICC_ID, mPhone.getIccSerialNumber());
                setSummaryText(KEY_IMEI, mPhone.getImei());
            } else {
                // device is not GSM/UMTS, do not display GSM/UMTS features
                // check Null in case no specified preference in overlay xml
                removePreferenceFromScreen(KEY_IMEI);
                removePreferenceFromScreen(KEY_ICC_ID);
            }
        } else {
            setSummaryText(KEY_IMEI, mPhone.getDeviceId());

            setSummaryText(KEY_IMEI_SV,
                    ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
                        .getDeviceSoftwareVersion());

            // device is not CDMA, do not display CDMA features
            // check Null in case no specified preference in overlay xml
            removePreferenceFromScreen(KEY_PRL_VERSION);
            removePreferenceFromScreen(KEY_MEID_NUMBER);
            removePreferenceFromScreen(KEY_MIN_NUMBER);
            removePreferenceFromScreen(KEY_ICC_ID);

            // only show area info when SIM country is Brazil
            if ("br".equals(mTelephonyManager.getSimCountryIso())) {
                mShowLatestAreaInfo = true;
            }
        }

答案 1 :(得分:0)

在Dual Sim设备中,每个SIM插槽都有两个IMEI编号。两者都是静态的。第一个IMEI号用于第一个插槽,第二个用于第二个插槽。