Android-Cdma手机定位

对于Android CDMA手机获取当前位置,其实有更便利的办法,就是哄骗CdmaCellLocation.getBaseStationLatitude(),然则getBaseStationLatitude()获取的是int值的纬度,在android doc里也没有具体的论说。国外的论坛也有人说getBaseStationLatitude()返回的是垃圾信息,昨天google到一个泡菜国兄弟的帖子才找到getBaseStationLatitude()获取的是int值与真正经纬度之间的关系。

 

  也就是CDMA层3和谈的定义:

    /** 
     * Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
     * It is represented in units of 0.25 seconds and ranges -1296000
     * to 1296000, both values inclusive (corresponding to a range of -90
     * to +90 degrees). Integer.MAX_VALUE is considered invalid value.
     */

    /**

     * Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
     * It is represented in units of 0.25 seconds and ranges -2592000
     * to 2592000, both values inclusive (corresponding to a range of -180
     * to +180 degrees). Integer.MAX_VALUE is considered invalid value.
     */

是以只要将getBaseStationLatitude()做如下处理惩罚即可:

double lat = (double)myCDMACellLoc.getBaseStationLatitude()  /14400;
double lon = (double)myCDMACellLoc.getBaseStationLongitude() /14400;

/14400即  *90/1296000

如许题目就解决了!!!

关键代码:

 

view plain
    1. telephonyManager =(TelephonyManager)getSystemService(TELEPHONY_SERVICE);  
    2. myCDMACellLoc = (CdmaCellLocation)telephonyManager.getCellLocation();  
    3. double lat = (double)myCDMACellLoc.getBaseStationLatitude()  /14400;  
    4. double lon = (double)myCDMACellLoc.getBaseStationLongitude() /14400;  

转载于:https://www.cnblogs.com/cellmap/p/3677820.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值