Android 基站分CdmaCellLocation和GsmCellLocation,要根据不同的SIM卡转成不同的对象
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
int type = tm.getNetworkType();//获取网络类型
//在中国,移动的2G是EGDE,联通的2G为GPRS,电信的2G为CDMA,电信的3G为EVDO
Location loc = null;
ArrayList CellID = new ArrayList();
//中国电信为CTC
//NETWORK_TYPE_EVDO_A是中国电信3G的getNetworkType
//NETWORK_TYPE_CDMA电信2G是CDMA
if (type == TelephonyManager.NETWORK_TYPE_EVDO_A || type == TelephonyManager.NETWORK_TYPE_CDMA || type ==TelephonyManager.NETWORK_TYPE_1xRTT)
{
location = (CdmaCellLocation) tm.getCellLocation();
if(location == null)
throw new Exception("errr");
String operator = tm.getNetworkOperator();
int cellIDs = location.getBaseStationId();
int networkID = location.getNetworkId();
StringBuilder sb = new StringBuilder();
sb.append(location.getSystemId());
int mnc = Integer.parseInt(nsb.toString());
int mcc = Integer.parseInt(operator.substring(0,3));
}
//移动2G卡 + CMCC + 2
//type = NETWORK_TYPE_EDGE
//联通的2G经过测试 China Unicom 1 NETWORK_TYPE_GPRS
else if(type == TelephonyManager.NETWORK_TYPE_EDGE || type == TelephonyManager.NETWORK_TYPE_GPRS)
{
GsmCellLocation location = (GsmCellLocation)tm.getCellLocation();
location = (CdmaCellLocation) tm.getCellLocation();
if(location == null)
throw new Exception("errr");
String operator = tm.getNetworkOperator();
int mcc = Integer.parseInt(operator.substring(0,3));
int mnc = Integer.parseInt(operator.substring(3));
int cid = location.getCid();
int lac = location.getLac();
}
分享到:
相关推荐
获取基站信息相关的内容,包括的想尽的信息内容,很清晰,很好用
google推荐获取基站信息软件 附件为android 版 network info II
NULL 博文链接:https://104zz.iteye.com/blog/1680860
源码 博文链接:https://104zz.iteye.com/blog/1680811
android定位之基站定位,获取不到GPS信号定位时解决定位
Android获取移动网络信息的工具类,可获取周围基站信息,IMEI号,IMSI号,本机号码等工具类,供大家参考使用
MCC,Mobile Country Code,移动国家代码(中国的为460); MNC,Mobile Network Code,移动网络号码(中国移动为0,中国联通为...CID,Cell Identity,基站编号; BSSS,Base station signal strength,基站信号强度。
android.permission.READ_PHONE_STATE - 获取基站信息及手机标识信息 android.permission.INTERNET - 访问网络 android.permission.ACCESS_NETWORK_STATE - 检查网络可用性及获取网络信息 android.permission.CHANGE...
这是超葛格刚刚封装好的定理信息定位代码,专门用于wifi定位、基站定位。本人是技术爱好者,如有同道中人,请联系我。本人QQ:82076424;本人邮箱mejg@163.com
Android基站想必大家有所耳闻吧手机通讯过程中距它最近的一个服务站吧,接下来将详细介绍下Android基站的具体位置获取,列出了详细的代码,感兴趣的朋友可以参考下
众所周知的,在OPhone和大部分国产的Android定制机里不支持最简单实用的基站和WIFI定位,只能使用速度慢而耗电的GPS定位,但OPhone和华为/中兴生产的一些Android定制机却占据了一定的市场,因此导致了很多使用了定位...
GPS 基站 原生定位可运行的GPS获取经纬度和获取基站例子(环境Android Studio 3.5.2扒拉能运行的例子找到太辛苦了要么版本太老。)
android google 定位程序 wifi基站GPS定位 等综合定位代码,
支持Android下GPS定位、基站定位、WIFI定位(获取ssid通过google服务获取地理位置)
NULL 博文链接:https://as11051105.iteye.com/blog/1536109
现在有这么一个需求:开启一个Service服务,获取当前...Android手机获取当前位置的方式:GPS定位,WIFI定位,基站定位,当前Demo使用GPS卫星定位,在LocationTool中返回Location、LocationManager两者对象,通过Loca
本文实例讲述了Android实现Service获取当前位置(GPS+基站)的方法。分享给大家供大家参考。具体如下: 需求详情: 1)、Service中每隔1秒执行一次定位操作(GPS+基站) 2)、定位的结果实时显示在界面上(要求得到经度、...
主要介绍了Android开发笔记之简单基站定位程序的实现,详细的介绍了基站定位其实很简单,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。
高德 开发 Android 定位SDK 开发指南 获取位置 获取定位数据