当前位置: 首页>>代码示例>>Java>>正文


Java CellIdentityGsm类代码示例

本文整理汇总了Java中android.telephony.CellIdentityGsm的典型用法代码示例。如果您正苦于以下问题:Java CellIdentityGsm类的具体用法?Java CellIdentityGsm怎么用?Java CellIdentityGsm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CellIdentityGsm类属于android.telephony包,在下文中一共展示了CellIdentityGsm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadCellInfo

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
public static void loadCellInfo(TelephonyManager tm, Device pDevice) {
    int lCurrentApiVersion = android.os.Build.VERSION.SDK_INT;
    try {
        if (pDevice.mCell == null) {
            pDevice.mCell = new Cell();
        }
        List<CellInfo> cellInfoList = tm.getAllCellInfo();
        if (cellInfoList != null) {
            for (final CellInfo info : cellInfoList) {

                //Network Type
                pDevice.mCell.setNetType(tm.getNetworkType());

                if (info instanceof CellInfoGsm) {
                    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                    final CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(gsm.getDbm()); // [dBm]
                    // Cell Identity
                    pDevice.mCell.setCID(identityGsm.getCid());
                    pDevice.mCell.setMCC(identityGsm.getMcc());
                    pDevice.mCell.setMNC(identityGsm.getMnc());
                    pDevice.mCell.setLAC(identityGsm.getLac());

                } else if (info instanceof CellInfoCdma) {
                    final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                    final CellIdentityCdma identityCdma = ((CellInfoCdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(cdma.getDbm());
                    // Cell Identity
                    pDevice.mCell.setCID(identityCdma.getBasestationId());
                    pDevice.mCell.setMNC(identityCdma.getSystemId());
                    pDevice.mCell.setLAC(identityCdma.getNetworkId());
                    pDevice.mCell.setSID(identityCdma.getSystemId());

                } else if (info instanceof CellInfoLte) {
                    final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                    final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(lte.getDbm());
                    pDevice.mCell.setTimingAdvance(lte.getTimingAdvance());
                    // Cell Identity
                    pDevice.mCell.setMCC(identityLte.getMcc());
                    pDevice.mCell.setMNC(identityLte.getMnc());
                    pDevice.mCell.setCID(identityLte.getCi());

                } else if  (lCurrentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) {
                    final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                    final CellIdentityWcdma identityWcdma = ((CellInfoWcdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(wcdma.getDbm());
                    // Cell Identity
                    pDevice.mCell.setLAC(identityWcdma.getLac());
                    pDevice.mCell.setMCC(identityWcdma.getMcc());
                    pDevice.mCell.setMNC(identityWcdma.getMnc());
                    pDevice.mCell.setCID(identityWcdma.getCid());
                    pDevice.mCell.setPSC(identityWcdma.getPsc());

                } else {
                    Log.i(TAG, mTAG + "Unknown type of cell signal!"
                            + "\n ClassName: " + info.getClass().getSimpleName()
                            + "\n ToString: " + info.toString());
                }
                if (pDevice.mCell.isValid()) {
                    break;
                }
            }
        }
    } catch (NullPointerException npe) {
       Log.e(TAG, mTAG + "loadCellInfo: Unable to obtain cell signal information: ", npe);
    }
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:73,代码来源:DeviceApi18.java

示例2: CellIdentity

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
public CellIdentity(CellIdentityGsm cellIdentity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        this.setChannelNumber(cellIdentity.getArfcn());
    }
    this.setMnc(cellIdentity.getMnc());
    this.setMcc(cellIdentity.getMcc());
    this.setLocationId(cellIdentity.getLac());

    /* CID Either 16-bit GSM Cell Identity described in
    * TS 27.007, 0..65535, Integer.MAX_VALUE if unknown */
    this.setAreaCode(cellIdentity.getCid());

    /* 6-bit Base Station Identity Code, Integer.MAX_VALUE if unknown */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        this.setScramblingCode(cellIdentity.getBsic());
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:18,代码来源:CellInformationWrapper.java

示例3: toCellularInfo

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
private static CommonCellInfo toCellularInfo(CellInfoGsm cellInfo) {

        CommonCellInfo res = new CommonCellInfo();
        CellIdentityGsm identityGsm = cellInfo.getCellIdentity();
        CellSignalStrength signalStrength = cellInfo.getCellSignalStrength();

        res.setType(GSM);

        res.setCid(identityGsm.getCid());
        res.setLac(identityGsm.getLac());
        res.setMcc(identityGsm.getMcc());
        res.setMnc(identityGsm.getMnc());
        res.setDbm(valdiateDbm(signalStrength.getDbm()));
        res.setLevel(signalStrength.getLevel());
        return res;
    }
 
开发者ID:ANFR-France,项目名称:proto-collecte,代码行数:17,代码来源:CellInfoUtil.java

示例4: createCellInfo

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
private static CellInfo createCellInfo(VCell cell) {
    if (cell.type == 2) { // CDMA
        CellInfoCdma cdma = mirror.android.telephony.CellInfoCdma.ctor.newInstance();
        CellIdentityCdma identityCdma = mirror.android.telephony.CellInfoCdma.mCellIdentityCdma.get(cdma);
        CellSignalStrengthCdma strengthCdma = mirror.android.telephony.CellInfoCdma.mCellSignalStrengthCdma.get(cdma);
        mirror.android.telephony.CellIdentityCdma.mNetworkId.set(identityCdma, cell.networkId);
        mirror.android.telephony.CellIdentityCdma.mSystemId.set(identityCdma, cell.systemId);
        mirror.android.telephony.CellIdentityCdma.mBasestationId.set(identityCdma, cell.baseStationId);
        mirror.android.telephony.CellSignalStrengthCdma.mCdmaDbm.set(strengthCdma, -74);
        mirror.android.telephony.CellSignalStrengthCdma.mCdmaEcio.set(strengthCdma, -91);
        mirror.android.telephony.CellSignalStrengthCdma.mEvdoDbm.set(strengthCdma, -64);
        mirror.android.telephony.CellSignalStrengthCdma.mEvdoSnr.set(strengthCdma, 7);
        return cdma;
    } else { // GSM
        CellInfoGsm gsm = mirror.android.telephony.CellInfoGsm.ctor.newInstance();
        CellIdentityGsm identityGsm = mirror.android.telephony.CellInfoGsm.mCellIdentityGsm.get(gsm);
        CellSignalStrengthGsm strengthGsm = mirror.android.telephony.CellInfoGsm.mCellSignalStrengthGsm.get(gsm);
        mirror.android.telephony.CellIdentityGsm.mMcc.set(identityGsm, cell.mcc);
        mirror.android.telephony.CellIdentityGsm.mMnc.set(identityGsm, cell.mnc);
        mirror.android.telephony.CellIdentityGsm.mLac.set(identityGsm, cell.lac);
        mirror.android.telephony.CellIdentityGsm.mCid.set(identityGsm, cell.cid);
        mirror.android.telephony.CellSignalStrengthGsm.mSignalStrength.set(strengthGsm, 20);
        mirror.android.telephony.CellSignalStrengthGsm.mBitErrorRate.set(strengthGsm, 0);
        return gsm;
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:27,代码来源:MethodProxies.java

示例5: getCellularInfo

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
public String getCellularInfo(TelephonyManager telephonyManager)
{
    String cellularInfo = "";
    String log = "";
    if(telephonyManager.getAllCellInfo()==null) {
        Log.v(TAG, "getAllCellInfo returned null");
    }
    else {
        for (final CellInfo info : telephonyManager.getAllCellInfo()) {
            if (info instanceof CellInfoGsm) {
                log += "[email protected]";
                CellIdentityGsm gsm_cell = ((CellInfoGsm) info).getCellIdentity();
                log += gsm_cell.getCid() + "#" + gsm_cell.getLac() + "#" + gsm_cell.getMcc() + "#" + gsm_cell.getMnc() + "_";

                final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                log += gsm.getDbm() + "#" + gsm.getLevel()+"#"+gsm.getAsuLevel()+":";
            } else if (info instanceof CellInfoCdma) {
                log += "[email protected]";
                CellIdentityCdma cdma_cell = ((CellInfoCdma) info).getCellIdentity();
                log += cdma_cell.getBasestationId() + "#" + cdma_cell.getNetworkId() + "#" + cdma_cell.getSystemId() + "#" + cdma_cell.getSystemId() + "_";

                final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                log += cdma.getDbm() + "#" + cdma.getLevel()+"#"+cdma.getAsuLevel()+":";
            } else if (info instanceof CellInfoLte) {
                log += "[email protected]";
                CellIdentityLte lte_cell = ((CellInfoLte) info).getCellIdentity();
                log += lte_cell.getCi() + "#" + lte_cell.getPci() + "#" + lte_cell.getMcc() + "#" + lte_cell.getMnc() + "_";

                final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                log += lte.getDbm() + "#" + lte.getLevel()+"#"+lte.getAsuLevel()+":";
            } else if (info instanceof CellInfoWcdma) {
                log += "[email protected]";
                CellIdentityWcdma wcdma_cell = ((CellInfoWcdma) info).getCellIdentity();
                log += wcdma_cell.getCid() + "#" + wcdma_cell.getLac() + "#" + wcdma_cell.getMcc() + "#" + wcdma_cell.getMnc() + "_";

                final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                log += wcdma.getDbm() + "#" + wcdma.getLevel()+"#"+wcdma.getAsuLevel()+":";
            } else {
                Log.v(TAG, "Unknown Network Type");
            }
        }
    }
    cellularInfo = log;
    return cellularInfo;
}
 
开发者ID:gautamgitspace,项目名称:CellularNetworkMonitor,代码行数:46,代码来源:CellularDataRecorder.java

示例6: cellInfoGSMJSON

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
/**
 * Converts CellInfoGsm into JSON
 * @param cellInfo CellInfoGsm
 * @return JSON
 */
public static String cellInfoGSMJSON(CellInfoGsm cellInfo, boolean returnSignalStrength){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) {
        try {
            json.put("provider", CELLINFO_PROVIDER);
            json.put("type", GSM);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityGsm identityGsm = cellInfo.getCellIdentity();

            json.put("cid", identityGsm.getCid());
            json.put("lac", identityGsm.getLac());
            json.put("mcc", identityGsm.getMcc());
            json.put("mnc", identityGsm.getMnc());

            if (returnSignalStrength){
                final JSONObject jsonSignalStrength = new JSONObject();
                final CellSignalStrengthGsm cellSignalStrengthGsm = cellInfo.getCellSignalStrength();
                jsonSignalStrength.put("asuLevel", cellSignalStrengthGsm.getAsuLevel());
                jsonSignalStrength.put("dbm", cellSignalStrengthGsm.getDbm());
                jsonSignalStrength.put("level", cellSignalStrengthGsm.getLevel());

                json.put("cellSignalStrengthGsm", jsonSignalStrength);
            }
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }
    return json.toString();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:40,代码来源:JSONHelper.java

示例7: type

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
public static SubjectFactory<CellIdentityGsmSubject, CellIdentityGsm> type() {
  return new SubjectFactory<CellIdentityGsmSubject, CellIdentityGsm>() {
    @Override
    public CellIdentityGsmSubject getSubject(FailureStrategy fs, CellIdentityGsm that) {
      return new CellIdentityGsmSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:CellIdentityGsmSubject.java

示例8: isValid

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public boolean isValid(CellIdentityGsm cell) {
    boolean valid = (isCidInRange(cell.getCid()) && isLacInRange(cell.getLac())
            && isMncInRange(cell.getMnc()) && isMccInRange(cell.getMcc()));
    if (!valid) {
        Log.w("isValid(): Invalid CellIdentityGsm [mcc=%s, mnc=%s, lac=%s, cid=%s, psc=%s]", cell.getMcc(), cell.getMnc(), cell.getLac(), cell.getCid(), cell.getPsc());
        Log.w("isValid(): Invalid CellIdentityGsm %s", cell);
    }
    return valid;
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:11,代码来源:GsmCellIdentityValidator.java

示例9: isValid

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public boolean isValid(CellIdentityGsm cell) {
    boolean valid = (isCidInRange(cell.getCid()) && isLacInRange(cell.getLac())
            && isMncInRange(cell.getMnc()) && isMccInRange(cell.getMcc())
            && isPscInRange(cell.getPsc()));
    if (!valid) {
        Log.w("isValid(): Invalid CellIdentityWcdma as Gsm JB_MR1 [mcc=%s, mnc=%s, lac=%s, cid=%s, psc=%s]", cell.getMcc(), cell.getMnc(), cell.getLac(), cell.getCid(), cell.getPsc());
        Log.w("isValid(): Invalid CellIdentityWcdma as Gsm JB_MR1 %s", cell);
    }
    return valid;
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:12,代码来源:WcdmaCellIdentityValidator.java

示例10: loadCellInfo

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
public static void loadCellInfo(TelephonyManager tm, Device pDevice) {
    int lCurrentApiVersion = Build.VERSION.SDK_INT;
    try {
        if (pDevice.cell == null) {
            pDevice.cell = new Cell();
        }
        List<CellInfo> cellInfoList = tm.getAllCellInfo();
        if (cellInfoList != null) {
            for (final CellInfo info : cellInfoList) {

                //Network Type
                pDevice.cell.setNetType(tm.getNetworkType());

                if (info instanceof CellInfoGsm) {
                    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                    final CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(gsm.getDbm()); // [dBm]
                    // Cell Identity
                    pDevice.cell.setCellId(identityGsm.getCid());
                    pDevice.cell.setMobileCountryCode(identityGsm.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityGsm.getMnc());
                    pDevice.cell.setLocationAreaCode(identityGsm.getLac());

                } else if (info instanceof CellInfoCdma) {
                    final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                    final CellIdentityCdma identityCdma = ((CellInfoCdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(cdma.getDbm());
                    // Cell Identity
                    pDevice.cell.setCellId(identityCdma.getBasestationId());
                    pDevice.cell.setMobileNetworkCode(identityCdma.getSystemId());
                    pDevice.cell.setLocationAreaCode(identityCdma.getNetworkId());
                    pDevice.cell.setSid(identityCdma.getSystemId());

                } else if (info instanceof CellInfoLte) {
                    final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                    final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(lte.getDbm());
                    pDevice.cell.setTimingAdvance(lte.getTimingAdvance());
                    // Cell Identity
                    pDevice.cell.setMobileCountryCode(identityLte.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityLte.getMnc());
                    pDevice.cell.setCellId(identityLte.getCi());

                } else if  (lCurrentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) {
                    final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                    final CellIdentityWcdma identityWcdma = ((CellInfoWcdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(wcdma.getDbm());
                    // Cell Identity
                    pDevice.cell.setLocationAreaCode(identityWcdma.getLac());
                    pDevice.cell.setMobileCountryCode(identityWcdma.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityWcdma.getMnc());
                    pDevice.cell.setCellId(identityWcdma.getCid());
                    pDevice.cell.setPrimaryScramblingCode(identityWcdma.getPsc());

                } else {
                    log.info("Unknown type of cell signal!"
                            + "\n ClassName: " + info.getClass().getSimpleName()
                            + "\n ToString: " + info.toString());
                }
                if (pDevice.cell.isValid()) {
                    break;
                }
            }
        }
    } catch (NullPointerException npe) {
        log.error("loadCellInfo: Unable to obtain cell signal information: ", npe);
    }
}
 
开发者ID:anticomarley,项目名称:Android-IMSI-Catcher-Detector,代码行数:73,代码来源:DeviceApi18.java

示例11: isValidGsmCell

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
/**
 * A valid gsm cell must have cell id != -1
 * Note: cells with cid > max value 0xffff are accepted (typically UMTS cells. We handle them separately
 * @param gsmIdentity {@link CellIdentityGsm}
 * @return true if valid gsm cell
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private boolean isValidGsmCell(final CellIdentityGsm gsmIdentity) {
	if (gsmIdentity == null) {
		return false;
	}

	final Integer cid = gsmIdentity.getCid();
	return (cid > 0 && cid != Integer.MAX_VALUE);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:16,代码来源:WirelessLoggerService.java

示例12: getVisibleCellPostJellyBeanMr1

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private static VisibleCell getVisibleCellPostJellyBeanMr1(
        @Nullable CellInfo cellInfo, long elapsedTime, long currentTime) {
    if (cellInfo == null) {
        return VisibleCell.UNKNOWN_VISIBLE_CELL;
    }
    long cellInfoAge = elapsedTime - TimeUnit.NANOSECONDS.toMillis(cellInfo.getTimeStamp());
    long cellTimestamp = currentTime - cellInfoAge;
    if (cellInfo instanceof CellInfoCdma) {
        CellIdentityCdma cellIdentityCdma = ((CellInfoCdma) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.CDMA_RADIO_TYPE)
                .setCellId(cellIdentityCdma.getBasestationId())
                .setLocationAreaCode(cellIdentityCdma.getNetworkId())
                .setMobileNetworkCode(cellIdentityCdma.getSystemId())
                .setTimestamp(cellTimestamp)
                .build();
    }
    if (cellInfo instanceof CellInfoGsm) {
        CellIdentityGsm cellIdentityGsm = ((CellInfoGsm) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.GSM_RADIO_TYPE)
                .setCellId(cellIdentityGsm.getCid())
                .setLocationAreaCode(cellIdentityGsm.getLac())
                .setMobileCountryCode(cellIdentityGsm.getMcc())
                .setMobileNetworkCode(cellIdentityGsm.getMnc())
                .setTimestamp(cellTimestamp)
                .build();
    }
    if (cellInfo instanceof CellInfoLte) {
        CellIdentityLte cellIdLte = ((CellInfoLte) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.LTE_RADIO_TYPE)
                .setCellId(cellIdLte.getCi())
                .setMobileCountryCode(cellIdLte.getMcc())
                .setMobileNetworkCode(cellIdLte.getMnc())
                .setPhysicalCellId(cellIdLte.getPci())
                .setTrackingAreaCode(cellIdLte.getTac())
                .setTimestamp(cellTimestamp)
                .build();
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
            && cellInfo instanceof CellInfoWcdma) {
        // CellInfoWcdma is only usable JB MR2 upwards.
        CellIdentityWcdma cellIdentityWcdma = ((CellInfoWcdma) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.WCDMA_RADIO_TYPE)
                .setCellId(cellIdentityWcdma.getCid())
                .setLocationAreaCode(cellIdentityWcdma.getLac())
                .setMobileCountryCode(cellIdentityWcdma.getMcc())
                .setMobileNetworkCode(cellIdentityWcdma.getMnc())
                .setPrimaryScramblingCode(cellIdentityWcdma.getPsc())
                .setTimestamp(cellTimestamp)
                .build();
    }
    return VisibleCell.UNKNOWN_VISIBLE_CELL;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:54,代码来源:PlatformNetworksManager.java

示例13: getAllCellInfo

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void getAllCellInfo(List<CellInfo> cellInfo) {
    // only for registered cells is returned identify
    // SlimKat in Galaxy Nexus - returns null :-/
    // Honor 7 - returns empty list (not null), Dual SIM?

    if (cellInfo!=null) {

        if (Permissions.checkLocation(context.getApplicationContext())) {

            //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "---- start ----------------------------");

            for (CellInfo _cellInfo : cellInfo) {
                //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "registered="+_cellInfo.isRegistered());

                if (_cellInfo instanceof CellInfoGsm) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "gsm info="+_cellInfo);
                    CellIdentityGsm identityGsm = ((CellInfoGsm) _cellInfo).getCellIdentity();
                    if (identityGsm.getCid() != Integer.MAX_VALUE) {
                        //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "gsm mCid="+identityGsm.getCid());
                        if (_cellInfo.isRegistered()) {
                            registeredCell = identityGsm.getCid();
                            lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                        }
                    }
                } else if (_cellInfo instanceof CellInfoLte) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "lte info="+_cellInfo);
                    CellIdentityLte identityLte = ((CellInfoLte) _cellInfo).getCellIdentity();
                    if (identityLte.getCi() != Integer.MAX_VALUE) {
                        //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "lte mCi="+identityLte.getCi());
                        if (_cellInfo.isRegistered()) {
                            registeredCell = identityLte.getCi();
                            lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                        }
                    }
                } else if (_cellInfo instanceof CellInfoWcdma) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma info="+_cellInfo);
                    //if (android.os.Build.VERSION.SDK_INT >= 18) {
                        CellIdentityWcdma identityWcdma = ((CellInfoWcdma) _cellInfo).getCellIdentity();
                        if (identityWcdma.getCid() != Integer.MAX_VALUE) {
                            //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma mCid=" + identityWcdma.getCid());
                            if (_cellInfo.isRegistered()) {
                                registeredCell = identityWcdma.getCid();
                                lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                            }
                        }
                    //}
                    //else {
                    //    PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma mCid=not supported for API level < 18");
                    //}
                } else if (_cellInfo instanceof CellInfoCdma) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "cdma info="+_cellInfo);
                    CellIdentityCdma identityCdma = ((CellInfoCdma) _cellInfo).getCellIdentity();
                    if (identityCdma.getBasestationId() != Integer.MAX_VALUE) {
                        //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma mCid="+identityCdma.getBasestationId());
                        if (_cellInfo.isRegistered()) {
                            registeredCell = identityCdma.getBasestationId();
                            lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                        }
                    }
                }
                //else {
                //    PPApplication.logE("PhoneStateScanner.getAllCellInfo", "unknown info="+_cellInfo);
                //}
            }

            //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "---- end ----------------------------");

            PPApplication.logE("PhoneStateScanner.getAllCellInfo", "registeredCell=" + registeredCell);
        }

    }
    else
        PPApplication.logE("PhoneStateScanner.getAllCellInfo", "cell info is null");
}
 
开发者ID:henrichg,项目名称:PhoneProfilesPlus,代码行数:76,代码来源:PhoneStateScanner.java

示例14: fill

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
public static void fill(TheDictionary map, CellIdentityGsm value) throws Exception {
	if (value != null) {
		map.put("type", "2");
		int i;
		i = value.getMcc();
		if (i != Integer.MAX_VALUE && i > 0 && i < 1000) map.put("mcc", i);
		i = value.getMnc();
		if (i != Integer.MAX_VALUE && i > 0 && i < 1000) map.put("mnc", i);
		i = value.getLac();
		if (i != Integer.MAX_VALUE && i > 0) map.put("lac", i);
		i = value.getCid();
		if (i != Integer.MAX_VALUE && i > 0) map.put("cid", i);
		//map.put("psc", value.getPsc()); // depricated
	}
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:16,代码来源:CellId.java

示例15: isValidGsmCell

import android.telephony.CellIdentityGsm; //导入依赖的package包/类
/**
 * A valid gsm cell must have cell id != -1
 * Note: cells with cid > max value 0xffff are accepted (typically UMTS cells. We handle them separately
 *
 * @param gsmIdentity {@link CellIdentityGsm}
 * @return true if valid gsm cell
 */
@TargetApi(JELLY_BEAN_MR1)
private boolean isValidGsmCell(final CellIdentityGsm gsmIdentity) {
    if (gsmIdentity == null) {
        return false;
    }

    final Integer cid = gsmIdentity.getCid();
    return (cid > 0 && cid != Integer.MAX_VALUE);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:17,代码来源:WirelessLoggerService.java


注:本文中的android.telephony.CellIdentityGsm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。