检索信号发射塔信息 [英] Retrieve cell towers information

查看:164
本文介绍了检索信号发射塔信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何获取GSM和CDMA在Android手机信号塔的列表。

Does anybody know how to retrieve cell tower list on GSM and CDMA on Android.

我一直在尝试使用谷歌地图API的位置: <一href="https://developers.google.com/maps/documentation/business/geolocation/">https://developers.google.com/maps/documentation/business/geolocation/

I have been trying to use Google Maps Locations API: https://developers.google.com/maps/documentation/business/geolocation/

和我想要得到手机信号塔与这些字段的信息:

And I want to get cell towers information with these fields:

  • CELLID:小区的唯一标识符。上的GSM,这是小区ID(CID); CDMA网络使用的基站ID(BID)。
  • locationArea code:该位置区域code(LAC)的GSM网络; CDMA网络使用网络ID(NID)。
  • mobileCountry code:小区发射塔的移动国家code(MCC)
  • mobileNetwork code:小区发射塔的移动网络code。这是跨国公司的GSM或系统ID(SID)用于CDMA。
  • 在年龄:毫秒数,因为这个小区是主。如果年龄是0,CELLID重新presents电流测量。
  • signalStrength:无线电信号以dBm测量强度
  • timingAdvance:定时提前值

这code没有特别让手机信号塔的信息。

This code doesn't especially getting cell towers information.

TelephonyManager tel = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

// Type of the network
int phoneTypeInt = tel.getPhoneType();
String phoneType = null;
phoneType = phoneTypeInt == TelephonyManager.PHONE_TYPE_GSM ? "gsm" : phoneType;
phoneType = phoneTypeInt == TelephonyManager.PHONE_TYPE_CDMA ? "cdma" : phoneType;
try {
  if (phoneType != null) {
    params.put("radioType", phoneType);
  }
} catch (Exception e) {}

/*
 * The below code doesn't work I think.
 */
JSONArray cellList = new JSONArray();
List<NeighboringCellInfo> neighCells = tel.getNeighboringCellInfo();
for (int i = 0; i < neighCells.size(); i++) {
  try {
    JSONObject cellObj = new JSONObject();
    NeighboringCellInfo thisCell = neighCells.get(i);
    cellObj.put("cellId", thisCell.getCid());
    cellList.put(cellObj);
  } catch (Exception e) {}
}
if (cellList.length() > 0) {
  try {
    params.put("cellTowers", cellList);
  } catch (JSONException e) {}
}

和我这样设置权限:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

请帮帮我,谢谢你。

推荐答案

您的手机可能不支持此功能。

Your phone might not support this function.

请参阅此:的http:// code .google.com / P /安卓/问题/详细信息?ID = 24136

和这样的:<一href="http://stackoverflow.com/questions/8025557/which-android-phone-models-support-getneighboringcellinfo">Which Android手机型号支持getNeighboringCellInfo()?

这篇关于检索信号发射塔信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆