本文整理汇总了Java中android.telephony.CellIdentityLte.getMcc方法的典型用法代码示例。如果您正苦于以下问题:Java CellIdentityLte.getMcc方法的具体用法?Java CellIdentityLte.getMcc怎么用?Java CellIdentityLte.getMcc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.CellIdentityLte
的用法示例。
在下文中一共展示了CellIdentityLte.getMcc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
示例4: 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;
}