本文整理汇总了Java中android.telephony.CellIdentityLte.getCi方法的典型用法代码示例。如果您正苦于以下问题:Java CellIdentityLte.getCi方法的具体用法?Java CellIdentityLte.getCi怎么用?Java CellIdentityLte.getCi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.CellIdentityLte
的用法示例。
在下文中一共展示了CellIdentityLte.getCi方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fill
import android.telephony.CellIdentityLte; //导入方法依赖的package包/类
public static void fill(TheDictionary map, CellIdentityLte value) throws Exception {
if (value != null) {
map.put("type", "4");
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.getTac();
if (i != Integer.MAX_VALUE && i > 0) map.put("tac", i);
i = value.getPci();
if (i != Integer.MAX_VALUE && i > 0) map.put("pci", i);
i = value.getCi();
if (i != Integer.MAX_VALUE && i > 0) map.put("cid", i);
}
}
示例2: getCellularInfo
import android.telephony.CellIdentityLte; //导入方法依赖的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;
}
示例3: isValidLteCell
import android.telephony.CellIdentityLte; //导入方法依赖的package包/类
/**
* A valid LTE cell must have cell id set
* @param cdmaLocation {@link CdmaCellLocation}
* @return true if valid cdma id
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private boolean isValidLteCell(final CellIdentityLte lteInfo) {
if (lteInfo == null) {
return false;
}
final Integer cid = lteInfo.getCi();
return ((cid > -1) && (cid < Integer.MAX_VALUE));
}
示例4: isValidLteCell
import android.telephony.CellIdentityLte; //导入方法依赖的package包/类
/**
* A valid LTE cell must have cell id set
*
* @param lteInfo {@link CellIdentityLte}
* @return true if valid cdma id
*/
@TargetApi(JELLY_BEAN_MR2)
private boolean isValidLteCell(final CellIdentityLte lteInfo) {
if (lteInfo == null) {
return false;
}
final Integer cid = lteInfo.getCi();
return ((cid > -1) && (cid < Integer.MAX_VALUE));
}
示例5: fill
import android.telephony.CellIdentityLte; //导入方法依赖的package包/类
public static void fill(TheDictionary map, CellIdentityLte value) throws Exception {
if (value != null) {
map.put("type", "4");
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.getTac(); if (i != Integer.MAX_VALUE && i > 0) map.put("tac", i);
i = value.getPci(); if (i != Integer.MAX_VALUE && i > 0) map.put("pci", i);
i = value.getCi(); if (i != Integer.MAX_VALUE && i > 0) map.put("ci", i);
}
}
示例6: getAllCellInfo
import android.telephony.CellIdentityLte; //导入方法依赖的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");
}
示例7: update
import android.telephony.CellIdentityLte; //导入方法依赖的package包/类
/**
* Adds or updates a cell tower.
* <p>
* If the cell tower is already in the list, its data is updated; if not, a
* new entry is created.
* <p>
* This method will set the cell's identity data, its signal strength and
* whether it is the currently serving cell.
* @return The new or updated entry.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public CellTowerLte update(CellInfoLte cell) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)
return null;
CellIdentityLte cid = cell.getCellIdentity();
CellTowerLte result = null;
CellTowerLte cand = this.get(cid.getMcc(), cid.getMnc(), cid.getTac(), cid.getCi());
if ((cand != null) && CellTower.matches(cid.getPci(), cand.getPci()))
result = cand;
if (result == null) {
cand = this.get(cid.getPci());
if ((cand != null)
&& ((cid.getMcc() == Integer.MAX_VALUE) || CellTower.matches(cid.getMcc(), cand.getMcc()))
&& ((cid.getMnc() == Integer.MAX_VALUE) || CellTower.matches(cid.getMnc(), cand.getMnc()))
&& ((cid.getTac() == Integer.MAX_VALUE) || CellTower.matches(cid.getTac(), cand.getTac()))
&& ((cid.getCi() == Integer.MAX_VALUE) ||CellTower.matches(cid.getCi(), cand.getCi())))
result = cand;
}
if (result == null)
result = new CellTowerLte(cid.getMcc(), cid.getMnc(), cid.getTac(), cid.getCi(), cid.getPci());
if (result.getMcc() == CellTower.UNKNOWN)
result.setMcc(cid.getMcc());
if (result.getMnc() == CellTower.UNKNOWN)
result.setMnc(cid.getMnc());
if (result.getTac() == CellTower.UNKNOWN)
result.setTac(cid.getTac());
if (result.getCi() == CellTower.UNKNOWN)
result.setCi(cid.getCi());
if (result.getPci() == CellTower.UNKNOWN)
result.setPci(cid.getPci());
this.put(result.getText(), result);
this.put(result.getAltText(), result);
result.setCellInfo(true);
result.setDbm(cell.getCellSignalStrength().getDbm());
result.setServing(cell.isRegistered());
Log.d(this.getClass().getSimpleName(), String.format("Added CellInfoLte for %s, %d G, %d dBm",
result.getText(),
result.getGeneration(),
result.getDbm()));
return result;
}