获取手机SIM卡基本信息

 public static MSSimInfo getSimInfo(Context context) {
        MSSimInfo msSimInfo = new MSSimInfo();
        TelephonyManager telManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String operator = telManager.getSimOperator();
        Log.e("zhaoming", "=operator==="+operator);
        if (operator != null) {

            if (operator.equals("46000") || operator.equals("46002") || operator.equals("46007")) {//中国移动


            } else if (operator.equals("46001")) {//中国联通


            } else if (operator.equals("46003")||operator.equals("46011")) {//中国电信
                CdmaCellLocation cdmaCellLocation = (CdmaCellLocation)
                        telManager.getCellLocation();
                int bid = cdmaCellLocation.getBaseStationId(); //获取cdma基站识别标号 BID
                int nid = cdmaCellLocation.getNetworkId(); //获取cdma网络编号NID
                int sid = cdmaCellLocation.getSystemId(); //用谷歌API的话cdma网络的mnc要用这个getSystemId()取得→SID
                Log.e("zhaoming", "sid---" + sid + "---nid" + nid + "--bid" + bid);
                msSimInfo.setBid(bid);
                msSimInfo.setSid(sid);
                msSimInfo.setNid(nid);
            } else {

            }

        }
        return msSimInfo;

    }

猜你喜欢

转载自blog.csdn.net/qq_25430563/article/details/89092360