安卓:CELLID不能适用于所有的运营商? [英] Android: CellID not available on all carriers?

查看:287
本文介绍了安卓:CELLID不能适用于所有的运营商?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我要求小区ID和LAC信息,在某些设备上,我不能retreive他们。

我用这个code:

  TelephonyManager TM =(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
位置=(GsmCellLocation)tm.getCellLocation();CELLID = location.getCid();LAC = location.getLac();


  1. 有谁知道为什么有些GSM运营商不提供呢?

  2. 请我需要为权限?

  3. 要了解哪些内容是关于存在的retreiving的CellID和LAC?


解决方案

所以,你可以尝试类似。我有小区ID和位置区code为GSM。但对于UMTS,getCid()返回一个大数目为33 exple 166 248.所以我加模运算符(exple xXx.getCid()%0xFFFF的)。

  GsmCellLocation cellLocation =(GsmCellLocation)telm.getCellLocation();    new_cid = cellLocation.getCid()%0xFFFF的;
    new_lac = cellLocation.getLac()%0xFFFF的;

When I request the Cell ID and LAC information, on some devices I cannot retreive them.

I use this code:

TelephonyManager tm =(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
location = (GsmCellLocation) tm.getCellLocation();

cellID = location.getCid();

lac = location.getLac();

  1. Does anyone know why some GSM carriers do not provide them?
  2. Do I need permissions for that?
  3. What else is there to know about retreiving the CellID and LAC?

解决方案

So you can try something like. I have got cell id and the location area code for GSM. But for UMTS, getCid () returns a big number for exple 33 166 248. So i add modulo operator (exple xXx.getCid() % 0xffff).

GsmCellLocation cellLocation = (GsmCellLocation)telm.getCellLocation();

    new_cid = cellLocation.getCid() % 0xffff;
    new_lac = cellLocation.getLac() % 0xffff;

这篇关于安卓:CELLID不能适用于所有的运营商?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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