android.telephony.TelephonyManager.getAllCellInfo()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中android.telephony.TelephonyManager.getAllCellInfo()方法的一些代码示例,展示了TelephonyManager.getAllCellInfo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TelephonyManager.getAllCellInfo()方法的具体详情如下:
包路径:android.telephony.TelephonyManager
类名称:TelephonyManager
方法名:getAllCellInfo

TelephonyManager.getAllCellInfo介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void shouldGiveAllCellInfo() {
 PhoneStateListener listener = mock(PhoneStateListener.class);
 telephonyManager.listen(listener, LISTEN_CELL_INFO);
 List<CellInfo> allCellInfo = Collections.singletonList(mock(CellInfo.class));
 shadowOf(telephonyManager).setAllCellInfo(allCellInfo);
 assertEquals(allCellInfo, telephonyManager.getAllCellInfo());
 verify(listener).onCellInfoChanged(allCellInfo);
}

代码示例来源:origin: openbmap/radiocells-scanner-android

/**
 * Checks if new cell info api is supported (i.e. TelephonyManager.getAllCellInfo() returning not null values)
 *
 * @return true if new api is supported by phone
 */
@SuppressLint("NewApi")
private boolean isNewApiSupported() {
  if (SDK_INT >= JELLY_BEAN_MR1) {
    return mTelephonyManager.getAllCellInfo() != null;
  } else {
    return false;
  }
}

代码示例来源:origin: microg/android_external_UnifiedNlpApi

@SuppressWarnings("deprecation")
private synchronized void fallbackScan() {
  if (lastScan + MIN_UPDATE_INTERVAL > System.currentTimeMillis()) return;
  List<CellInfo> allCellInfo = telephonyManager.getAllCellInfo();
  if ((allCellInfo == null || allCellInfo.isEmpty()) && telephonyManager.getNetworkType() > 0) {
    allCellInfo = new ArrayList<CellInfo>();
    CellLocation cellLocation = telephonyManager.getCellLocation();
    CellInfo cellInfo = fromCellLocation(cellLocation);
    if (cellInfo != null) allCellInfo.add(cellInfo);
  }
  onCellsChanged(allCellInfo);
}

代码示例来源:origin: stackoverflow.com

for (final CellInfo info : tm.getAllCellInfo()) {
  if (info instanceof CellInfoGsm) {
    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();

代码示例来源:origin: fooock/phone-tracker

@Override
  public void run() {
    final boolean permEnabled = checkPermission.hasAnyPermission(
        PhoneTracker.LOCATION_PERMISSIONS);
    final int scanDelay = cellConfiguration.getScanDelay();
    if (!permEnabled) {
      Log.w(TAG, "Location permissions not granted to cell scan, trying again in "
          + scanDelay + "ms");
      handler.postDelayed(this, scanDelay);
      return;
    }
    final List<CellInfo> cellInfo = telephonyManager.getAllCellInfo();
    final long timestamp = System.currentTimeMillis();
    if (cellInfo == null || cellInfo.isEmpty()) {
      if (cellScanListener != null) {
        cellScanListener.onCellInfoReceived(
            timestamp, Collections.<CellInfo>emptyList());
      }
    } else {
      if (cellScanListener != null) {
        cellScanListener.onCellInfoReceived(timestamp, cellInfo);
      }
    }
    Log.d(TAG, "Scanning cell every " + scanDelay + "ms");
    handler.postDelayed(this, scanDelay);
  }
});

代码示例来源:origin: stackoverflow.com

List<CellInfo> infos = tel.getAllCellInfo();
for (int i = 0; i<infos.size(); ++i) {
  try {

代码示例来源:origin: stackoverflow.com

String res = "";
    try {
      List<CellInfo> cellInfoList = tm.getAllCellInfo();

代码示例来源:origin: openbmap/radiocells-scanner-android

final List<CellInfo> cellInfoList = mTelephonyManager.getAllCellInfo();
Log.v(TAG, "Found " + cellInfoList.size() + " cells");
for (final CellInfo info : cellInfoList) {

代码示例来源:origin: wiglenet/wigle-wifi-wardriving

List<CellInfo> infos = tele.getAllCellInfo();
if (null != infos) {
  for (final CellInfo cell : infos) {

代码示例来源:origin: AlexZhuo/AlxLocationManager

List<CellInfo> infos = mTelephonyManager.getAllCellInfo();
if(infos!=null) {
  if(infos.size()==0)return cellInfo;

代码示例来源:origin: thuryn/your-local-weather

List<CellInfo> cellsRawList = null;
try {
  cellsRawList = mTelephonyManager.getAllCellInfo();
} catch (SecurityException securityException) {
  appendLog(context, TAG, "SecurityException when getCellLocation is called ", securityException);

代码示例来源:origin: n76/DejaVu

allCells = tm.getAllCellInfo();
} catch (NoSuchMethodError e) {
  allCells = null;

代码示例来源:origin: termux/termux-api

out.beginArray();
for (CellInfo cellInfo : manager.getAllCellInfo()) {
  out.beginObject();
  if (cellInfo instanceof CellInfoGsm) {

相关文章