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


Java CellInfoWcdma类代码示例

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


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

示例1: loadCellInfo

import android.telephony.CellInfoWcdma; //导入依赖的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: getCellInfo

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
/**
 * Get current cell info
 * 
 * @return cell information format as {@link String}
 */
public String getCellInfo() {
	if (DBG)
		Log.d(Config.TAG, TAG + "getCellInfo called");
	String ret = null;
	List<CellInfo> listCellInfo = mTelMgr.getAllCellInfo();
	if (listCellInfo != null)
		for (CellInfo a_Info : listCellInfo) {
			if (CellInfoCdma.class.isInstance(a_Info))
				ret = ret + "\n Cell info cdma: " + a_Info.toString();
			else if (CellInfoGsm.class.isInstance(a_Info))
				ret = ret + "\n Cell info gsm: " + a_Info.toString();
			else if (CellInfoLte.class.isInstance(a_Info)) {
				ret = ret + "\n Cell info lte: " + a_Info.toString();
				CellInfoLte cellInfoLte = (CellInfoLte) a_Info;
				CellIdentityLte cellIdentity = cellInfoLte
						.getCellIdentity();
				Log.d(Config.TAG, TAG + " LTE - " + cellIdentity.getCi()
						+ cellIdentity.getTac() + cellIdentity.getPci());

			} else if (CellInfoWcdma.class.isInstance(a_Info))
				ret = ret + "\n Cell info : wcdma" + a_Info.toString();
		}
	return ret;
}
 
开发者ID:adetalhouet,项目名称:SignalAnalysis,代码行数:30,代码来源:PhoneStateHelper.java

示例3: getSignalStrengthDbm

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
/**
 * @return Signal strength (in dbM) from {@link cellInfo}. Returns {@link
 * CellularSignalStrengthError#ERROR_NOT_SUPPORTED} if the signal strength is unavailable.
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private static int getSignalStrengthDbm(CellInfo cellInfo) {
    if (cellInfo instanceof CellInfoCdma) {
        return ((CellInfoCdma) cellInfo).getCellSignalStrength().getDbm();
    }
    if (cellInfo instanceof CellInfoGsm) {
        return ((CellInfoGsm) cellInfo).getCellSignalStrength().getDbm();
    }
    if (cellInfo instanceof CellInfoLte) {
        return ((CellInfoLte) cellInfo).getCellSignalStrength().getDbm();
    }
    if (cellInfo instanceof CellInfoWcdma) {
        return ((CellInfoWcdma) cellInfo).getCellSignalStrength().getDbm();
    }
    return CellularSignalStrengthError.ERROR_NOT_SUPPORTED;
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:21,代码来源:AndroidCellularSignalStrength.java

示例4: getSignalStrengthLevel

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
/**
 * @return the signal level from {@link cellInfo}. Returns {@link
 * CellularSignalStrengthError#ERROR_NOT_SUPPORTED} if the signal
 * level is unavailable with lower value indicating lower signal strength.
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private static int getSignalStrengthLevel(CellInfo cellInfo) {
    if (cellInfo instanceof CellInfoCdma) {
        return ((CellInfoCdma) cellInfo).getCellSignalStrength().getLevel();
    }
    if (cellInfo instanceof CellInfoGsm) {
        return ((CellInfoGsm) cellInfo).getCellSignalStrength().getLevel();
    }
    if (cellInfo instanceof CellInfoLte) {
        return ((CellInfoLte) cellInfo).getCellSignalStrength().getLevel();
    }
    if (cellInfo instanceof CellInfoWcdma) {
        return ((CellInfoWcdma) cellInfo).getCellSignalStrength().getLevel();
    }
    return CellularSignalStrengthError.ERROR_NOT_SUPPORTED;
}
 
开发者ID:lizhangqu,项目名称:chromium-net-for-android,代码行数:22,代码来源:AndroidCellularSignalStrength.java

示例5: CellInformationWrapper

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
public CellInformationWrapper(CellInfo cellInfo) {
    setRegistered(cellInfo.isRegistered());
    this.setTimeStamp(cellInfo.getTimeStamp());

    if (cellInfo.getClass().equals(CellInfoLte.class)) {
        setTechnology(Technology.CONNECTION_4G);
        this.ci = new CellIdentity(((CellInfoLte) cellInfo).getCellIdentity());
        this.cs = new CellSignalStrength(((CellInfoLte) cellInfo).getCellSignalStrength());
    }
    else if (cellInfo.getClass().equals(CellInfoWcdma.class)) {
        setTechnology(Technology.CONNECTION_3G);
        this.ci = new CellIdentity(((CellInfoWcdma) cellInfo).getCellIdentity());
        this.cs = new CellSignalStrength(((CellInfoWcdma) cellInfo).getCellSignalStrength());
    }
    else if (cellInfo.getClass().equals(CellInfoGsm.class)) {
        setTechnology(Technology.CONNECTION_2G);
        this.ci = new CellIdentity(((CellInfoGsm) cellInfo).getCellIdentity());
        this.cs = new CellSignalStrength(((CellInfoGsm) cellInfo).getCellSignalStrength());
    }
    else if (cellInfo.getClass().equals(CellInfoCdma.class)) {
        setTechnology(Technology.CONNECTION_2G);
        this.ci = new CellIdentity(((CellInfoCdma) cellInfo).getCellIdentity());
        this.cs = new CellSignalStrength(((CellInfoCdma) cellInfo).getCellSignalStrength());
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:26,代码来源:CellInformationWrapper.java

示例6: isValid

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
public boolean isValid(CellInfo cellInfo) {
    if (cellInfo instanceof CellInfoGsm) {
        CellInfoGsm gsmCellInfo = (CellInfoGsm) cellInfo;
        // If is compatible with API 17 hack (PSC on GSM) return true
        boolean wcdmaApi17Valid = getWcdmaValidator().isValid(gsmCellInfo.getCellIdentity());
        if (wcdmaApi17Valid)
            return true;
        return getGsmValidator().isValid(gsmCellInfo.getCellIdentity());
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo instanceof CellInfoWcdma) {
        CellInfoWcdma wcdmaCellInfo = (CellInfoWcdma) cellInfo;
        return getWcdmaValidator().isValid(wcdmaCellInfo.getCellIdentity());
    }
    if (cellInfo instanceof CellInfoLte) {
        CellInfoLte lteCellInfo = (CellInfoLte) cellInfo;
        return getLteValidator().isValid(lteCellInfo.getCellIdentity());
    }
    if (cellInfo instanceof CellInfoCdma) {
        CellInfoCdma cdmaCellInfo = (CellInfoCdma) cellInfo;
        return getCdmaValidator().isValid(cdmaCellInfo.getCellIdentity());
    }
    throw new UnsupportedOperationException("Cell identity type not supported `" + cellInfo.getClass().getName() + "`");
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:24,代码来源:CellIdentityValidator.java

示例7: getCellularInfo

import android.telephony.CellInfoWcdma; //导入依赖的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

示例8: getWcdmaSignalStrength

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
private void getWcdmaSignalStrength() {
    List<CellInfo> cellInfoList = mTM.getAllCellInfo();

    if (cellInfoList == null) {
        //Log.e(Tag,"getAllCellInfo is null");
        return;
    }
    //Log.e(Tag,"getAllCellInfo size "+cellInfoList.size());

    for (CellInfo cellInfo : cellInfoList) {

        if (!cellInfo.isRegistered())
            continue;

        if (cellInfo instanceof CellInfoWcdma) {
            CellInfoWcdma wcdmaInfo = (CellInfoWcdma) cellInfo;
            wcdma_RSSI = wcdmaInfo.getCellSignalStrength().getDbm();
        }
    }
}
 
开发者ID:hugecheng,项目名称:CellularSignal,代码行数:21,代码来源:RadioInfo.java

示例9: fill

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static void fill(TheDictionary map, CellInfo value) throws Exception {
	if (value != null) {
		map.put("time_stamp", value.getTimeStamp());
		map.put("registered", value.isRegistered());
		if (value instanceof CellInfoCdma) {
			fill(map, ((CellInfoCdma) value).getCellIdentity());
			fill(map, ((CellInfoCdma) value).getCellSignalStrength());
		} else if (value instanceof CellInfoGsm) {
			fill(map, ((CellInfoGsm) value).getCellIdentity());
			fill(map, ((CellInfoGsm) value).getCellSignalStrength());
		} else if (value instanceof CellInfoWcdma) {
			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
				fill(map, ((CellInfoWcdma) value).getCellIdentity());
				fill(map, ((CellInfoWcdma) value).getCellSignalStrength());
			}
		} else if (value instanceof CellInfoLte) {
			fill(map, ((CellInfoLte) value).getCellIdentity());
			fill(map, ((CellInfoLte) value).getCellSignalStrength());
		} else {
			map.put("class", value.getClass().getName());
			map.put("string", value.toString());
		}
	}
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:26,代码来源:CellId.java

示例10: toCellularInfo

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
public ArrayList<CommonCellInfo> toCellularInfo(List<CellInfo> cellInfoList) {
    final ArrayList<CommonCellInfo> res = new ArrayList<CommonCellInfo>();
    if (cellInfoList == null) {
        return res;
    }

    for (CellInfo cellInfo : cellInfoList) {
        if (!cellInfo.isRegistered()) {
            continue;
        }
        //Wcdma : Wideband Code Division Multiple Access : multiplexage par code à large bande
        if (cellInfo instanceof CellInfoWcdma) {
            CellInfoWcdma cellInfoWcdma = (CellInfoWcdma) cellInfo;
            res.add(toCellularInfo(cellInfoWcdma));
        }

        if (cellInfo instanceof CellInfoGsm) {
            final CellInfoGsm cellInfoGsm = (CellInfoGsm) cellInfo;
            res.add(toCellularInfo(cellInfoGsm));
        }

        if (cellInfo instanceof CellInfoLte) {
            final CellInfoLte cellInfoLte = (CellInfoLte) cellInfo;
            res.add(toCellularInfo(cellInfoLte));
        }

        // TODO: gérer CDMA
    }
    return res;
}
 
开发者ID:ANFR-France,项目名称:proto-collecte,代码行数:31,代码来源:CellInfoUtil.java

示例11: cellInfoWCDMAJSON

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
/**
 * Converts CellInfoWcdma into JSON
 * Some devices may not work correctly:
 * - Reference 1: https://code.google.com/p/android/issues/detail?id=191492
 * - Reference 2: http://stackoverflow.com/questions/17815062/cellidentitygsm-on-android
 * @param cellInfo CellInfoWcdma
 * @return JSON
 */
public static String cellInfoWCDMAJSON(CellInfoWcdma 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", WCDMA);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityWcdma identityWcdma = cellInfo.getCellIdentity();

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

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

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

示例12: processCellInfos

import android.telephony.CellInfoWcdma; //导入依赖的package包/类
private static void processCellInfos(List<CellInfo> cellInfos){
    if(cellInfos != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){

        for(CellInfo cellInfo : cellInfos){

            if(cellInfo instanceof  CellInfoWcdma){
                final CellInfoWcdma cellInfoWcdma = (CellInfoWcdma) cellInfo;
                sendCallback(PluginResult.Status.OK,
                        JSONHelper.cellInfoWCDMAJSON(cellInfoWcdma, _returnSignalStrength));
            }
            if(cellInfo instanceof CellInfoGsm){
                final CellInfoGsm cellInfoGsm = (CellInfoGsm) cellInfo;
                sendCallback(PluginResult.Status.OK,
                        JSONHelper.cellInfoGSMJSON(cellInfoGsm, _returnSignalStrength));
            }
            if(cellInfo instanceof  CellInfoCdma){
                final CellInfoCdma cellIdentityCdma = (CellInfoCdma) cellInfo;
                sendCallback(PluginResult.Status.OK,
                        JSONHelper.cellInfoCDMAJSON(cellIdentityCdma, _returnSignalStrength));
            }
            if(cellInfo instanceof  CellInfoLte){
                final CellInfoLte cellInfoLte = (CellInfoLte) cellInfo;
                sendCallback(PluginResult.Status.OK,
                        JSONHelper.cellInfoLTEJSON(cellInfoLte, _returnSignalStrength));
            }

            Log.d(TAG,cellInfo.toString());
        }
    }
    else {
        Log.e(TAG, "CellInfoLocation returning null. Is it supported on this phone?");

        // There are several reasons as to why cell location data would be null.
        // * could be an older device running an unsupported version of the Android OS
        // * could be a device that doesn't support this capability.
        // * could be incorrect permissions: ACCESS_COARSE_LOCATION
        sendCallback(PluginResult.Status.ERROR,
                JSONHelper.errorJSON(CELLINFO_PROVIDER, ErrorMessages.CELL_DATA_IS_NULL()));
    }
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:41,代码来源:CellLocationController.java

示例13: type

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

示例14: loadCellInfo

import android.telephony.CellInfoWcdma; //导入依赖的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

示例15: getVisibleCellPostJellyBeanMr1

import android.telephony.CellInfoWcdma; //导入依赖的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


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