目前程序在移动3G网络中不能定位。不知道各位遇到过这个问题没?
if ((String) getNetType(pContext) != "UNKNOWN"&& ((String) getNetType(pContext) == "HSDPA" || getNetType ( pContext) == "HSPA")) {// 移动3G
location = null;
GsmCellLocation gcl = (GsmCellLocation) tm.getCellLocation();
if (gcl == null) {
return null;
}这时候gcl总是为空的。各位有什么解决办法没?求高手指点哈
if ((String) getNetType(pContext) != "UNKNOWN"&& ((String) getNetType(pContext) == "HSDPA" || getNetType ( pContext) == "HSPA")) {// 移动3G
location = null;
GsmCellLocation gcl = (GsmCellLocation) tm.getCellLocation();
if (gcl == null) {
return null;
}这时候gcl总是为空的。各位有什么解决办法没?求高手指点哈
解决方案 »
- android的如何使用异或方式绘图。
- android怎么样多个listview的adapter引用同一个HashMap<String, SoftReference<Drawable>>?
- 安卓访问数据库
- 加入有米广告时AdManager.init(),第一个参数的问题
- 菜鸟 求助R.layout.dialog_view 为什么我点不出来,手写上去报错啊
- [站点推荐]Android学习指南
- Listview 探讨
- 请教为何android把应用结构设计的这么复杂?
- 都说做Java的转向Android非常简单,具体要怎样做呢
- 我的ubuntu上常用快捷键不好用
- android程序不按正确执行顺序
- 请问怎么动态创建一个layout和SurfaceView,我怎么显示不出来?
但是用Location API的NETWORK方式我一直没成功定位过,不知道为何,GPS方式的话只能在室外定位。
楼主的基站定位的话CDMA是会返回空的,文档里写了。。
谁能解释下NETWORK方式的定位,为何照着资料写在真机上就没成功定位过。?
GsmCellLocation location = (GsmCellLocation) tm.getCellLocation();
int cellIDs = location.getCid();
int lac = location.getLac();
CellIDInfo info = new CellIDInfo();
info.cellId = cellIDs;
info.locationAreaCode = lac;
// 经过测试,获取联通数据以下两行必须去掉,否则会出现错误,错误类型为JSON Parsing Error
// info.mobileNetworkCode = tm.getNetworkOperator().substring(3, 5);
// info.mobileCountryCode = tm.getNetworkOperator().substring(0, 3);
info.radioType = "gsm";
CellID.add(info);
}这个是我联通2g的处理方法