【问题标题】:get right cellID in android network?在android网络中获得正确的cellID?
【发布时间】:2016-03-28 09:01:43
【问题描述】:

我一直在努力在 android 网络中找到正确的 CellID。我正在尝试搜索教程,我找到了类似这样的解决方案:

telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
cellLocation = (GsmCellLocation) telephonyManager.getCellLocation();

然后要访问 CellID,请使用以下代码:

cellLocation.getCid() % 0xffff

当我运行应用程序时,我得到了一个 ID 号。但是,问题是不同的 IDCELL 与 G Nettrack 应用程序作为参考。然后,CELLID 与原始数据不匹配。 请帮忙!谢谢

【问题讨论】:

  • 哪种网络类型? LTE?
  • 我一直在试3g

标签: android cellid


【解决方案1】:

我认为你做错了计算。 对于 GSM 网络:应该是 '&' 而不是 '%'

GsmCellLocation loc = (GsmCellLocation) tm.getCellLocation();
 if (loc != null) 
  {
  long cellID = loc.getCid() & 0xffff;
  }

对于 4g/LTE cellid,有一篇写得很好的文章here.follow that。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-09
  • 1970-01-01
  • 1970-01-01
  • 2018-05-05
相关资源
最近更新 更多