最近在写一个项目,使用到定位应用 。由于电信机型无法使用Android sdk中的LocationManager进行定位,只能另外写了一个使用Cellinfo进行定位的函数,测试过CoolPad手机是可以获取到位置,但在一款新的三星机上就无法进行定位了,它屏闭了mobileNetworkoperator,得出来竟然是空值。无耐中只能自己填写对应的国家码460,位置是取回来了,但偏差不是一般大。超过2公里。if (type == TelephonyManager.NETWORK_TYPE_CDMA
|| type == TelephonyManager.NETWORK_TYPE_1xRTT
|| type == TelephonyManager.NETWORK_TYPE_EVDO_A
|| type == TelephonyManager.NETWORK_TYPE_EVDO_0) {
cdma = ((CdmaCellLocation) manager.getCellLocation());
try {

if (cdma == null) {
Utility.WriteLog(TAG, "celllocation is null");
return null;
} else {

Utility.WriteLog(TAG, "celllocation is not null");
int sid = cdma.getSystemId();// 系统标识 mobileNetworkCode
int bid = cdma.getBaseStationId();// 基站小区号 cellId
int nid = cdma.getNetworkId();// 网络标识 locationAreaCode // Log.i("sid:", "-" + sid);
// Log.i("bid:", "-" + bid);
// Log.i("nid:", "-" + nid);
Utility.WriteLog(TAG, "Nid:" + nid);
CellIDInfo info = new CellIDInfo();
info.cellId = bid;
info.locationAreaCode = nid;
info.mobileNetworkCode = String.valueOf(sid);
String ss = manager.getNetworkOperator();
Utility.WriteLog(TAG, "networkoperator:" + ss);
if (ss == null || ss.length() == 0) {
info.mobileCountryCode = "460";
//info.mobileCountryCode = "03";
} else {
info.mobileCountryCode = manager.getNetworkOperator()
.substring(0, 3);
// info.mobileCountryCode = manager.getNetworkOperator()
// .substring(3, 5);
}
info.radioType = "cdma";
CellID.add(info);
return CellID;这是其中获取CDMA基站信息的代码。
也尝试过使用
double lat = (double) myCDMACellLoc
 .getBaseStationLatitude() / 14400;
 double lon = (double) myCDMACellLoc
 .getBaseStationLongitude() / 14400;的方法,但回来的经纬度应该是受加密的。不能被使用。不知道有没有高手可以解决到CDMA 室 内定位的问题,感谢。

解决方案 »

  1.   

    是指对double lat = (double) myCDMACellLoc
    .getBaseStationLatitude() / 14400;
     double lon = (double) myCDMACellLoc
    .getBaseStationLongitude() / 14400;的方法,进行解密的公式吗?
      

  2.   


    请问是哪个接口,我在上面搜了下,没发现定位相关API。是不是需要申请开发者才能看到?
      

  3.   

    LZ问题解决了吗,
    double lat = (double) myCDMACellLoc
    .getBaseStationLatitude() / 14400;
     double lon = (double) myCDMACellLoc
    .getBaseStationLongitude() / 14400;
    用这个方法,在同一个地方会得到不一样的结果,而且误差很大