Android Google Map实例 - 获取cdma基站经纬度(Android mapview)
来源:互联网 发布:mac虚拟机win7激活码 编辑:程序博客网 时间:2024/05/16 10:04
已经将GPS信息标注在google map上了,怎么将目前正在提供服务的基站位置也标注在google map上呢?
标注的方法与标注自定义图标一样,关键是如何获取cdma cell location,为这个问题困扰了好几天,有人说利用google gears方法,不过这种方法原理是取得目前通讯的基站信息譬如cid nid等,上网查询并反馈对应的基站经纬度,需要对应的网站有足够的基站经纬度信息。
对于CDMA手机其实有更方便的方法,就是利用CdmaCellLocation.getBaseStationLatitude(),但是getBaseStationLatitude()获取的是int值的纬度,在android doc里也没有详细的阐述。国外的论坛也有人说getBaseStationLatitude()返回的是垃圾信息,昨天google到一个泡菜国兄弟的帖子才找到getBaseStationLatitude()获取的是int值与真正经纬度之间的关系。
也就是CDMA层3协议的定义:
/**
* Latitude is a decimal number asspecified in 3GPP2 C.S0005-A v6.0.
* It is represented in units of 0.25seconds and ranges from -1296000
* to 1296000, both values inclusive(corresponding to a range of -90
* to +90 degrees). Integer.MAX_VALUEis considered invalid value.
*/
/**
* Longitude is a decimal number asspecified in 3GPP2 C.S0005-A v6.0.
* It is represented in units of 0.25seconds and ranges from -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
这样问题就解决了!!!
关键代码:
- telephonyManager =(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
- myCDMACellLoc = (CdmaCellLocation)telephonyManager.getCellLocation();
- double lat = (double)myCDMACellLoc.getBaseStationLatitude() /14400;
- double lon = (double)myCDMACellLoc.getBaseStationLongitude() /14400;
Android Google Map实例 - 不同的图标标注在同一图层(Android mapview)
Android Google Map实例 - 添加GPS位置标注(Android mapview)
- Android Google Map实例 - 获取cdma基站经纬度(Android mapview)
- Android Google Map实例 - 获取cdma基站经纬度(Android mapview)
- Android Google Map实例 - MD5 、Google Map API Key获取(Android mapview)
- Android Google Map实例 - MD5 、Google Map API Key获取(Android mapview)
- CDMA基站定位获取经纬度
- Android Google Map实例 - 添加GPS位置标注(Android mapview)
- Android Google Map实例 - 添加GPS位置标注(Android mapview)
- Android Google Map实例 - 发布Android Google Map 程序(Android mapview)
- Android Google Map实例 - 发布Android Google Map 程序(Android mapview) .
- Android Google Map实例 - 创建一个Google Map例程(Android mapview)
- Android Google Map实例 - 添加Google Map自定义图层(Android mapview)
- android根据基站信息获取经纬度
- Android Google Map实例 - 安装到手机后的效果(Android mapview)
- Android Google Map实例 - 在地图和卫星图之间切换(Android mapview)
- Android Google Map实例 - 不同的图标标注在同一图层(Android mapview)
- android GSM+CDMA基站定位
- android GSM+CDMA基站定位
- android GSM+CDMA基站定位
- SQL 常用语句
- java例程练习(继承中的构造函数)
- smarty syntax error: unrecognized tag 'var' 的原因及解决方法
- Select语句中的注意事项
- 《Android------短信发射器》
- Android Google Map实例 - 获取cdma基站经纬度(Android mapview)
- C 内存管理详解
- ORA-12154 和 TNS-03505 监听错误的解决方法
- oracle 赋值权限以及回滚点
- Linux下安装 matlab
- struts2注解
- 各种字符串Hash函数比较
- xsl使用示例
- php等比例压缩图片(jpg,jif,png图片等比例压缩)