技术标签: Android填坑记
LAC/CI值常用作基站定位,基站定位是指手机发射基站根据与手机的距离来计算手机坐标地理位置的一种功能,基站定位一般应用于手机用户。
LAC:location area code 位置区码 (移动通信系统中),是为寻呼而设置的一个区域,覆盖一片地理区域,初期一般按行政区域划分(一个县或一个区),现在很灵活了,按寻呼量划分。当一个LAC下的寻呼量达到一个预警门限,就必须拆分。 为了确定移动台的位置,每个GSMPLMN的覆盖区都被划分成许多位置区,位置区码(LAC)则用于标识不同的位置区。一个位置区可以包含一个或多个小区,小区即为CI。
手机基站定位服务又叫做移动位置服务(LBS服务),它是通过电信移动运营商的网络(如GSM网)获取移动终端用户的位置信息(经纬度坐标),在电子地图平台的支持下,为用户提供相应服务的一种增值业务。
不同型号的硬件,查询基站定位功能发送的AT指令也是不一样。
发送AT指令:@DTU:0000:GPS?
返回的坐标值:@DTU:0000:GPS?
+GPS: Lac:0x3910,CellId:0xEC7D
其中的0X3910为LAC(小区号),0XEC7D为CID(基站号)。
把座标值输入到网站 www.cellid.cn,可以自动输出经纬度、地址名称。
当然也可以通过Webservice请求到相应的地图网站(高德地图、百度地图均可),然后网站会自动返回带有经纬度的信息。
要使用基站定位接口,须在网络上找一个解析。定位精度最终取决于当地基站的密度。城市大概50到150米,城郊大概100到300米,乡村大概200到2000米,偏远地区由于基站的密度太少,所以就会很差。
了解了其中的作用,就开始使用。第一步就是添加权限。因为主要用于定位。所以所需要的权限也都类属与定位权限。首先在AndroidManifest.xml文件里添加权限。
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
因为各个运营商之间采用的技术不尽相同,所以获取方式也不太一样。国内三大运营商的获取方式如下:
TelephonyManager tel = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
CellLocation cel = tel.getCellLocation();
int nPhoneType = tel.getPhoneType();
//移动联通 GsmCellLocation
if (nPhoneType == 2 && cel instanceof GsmCellLocation) {
GsmCellLocation gsmCellLocation = (GsmCellLocation) cel;
int nGSMCID = gsmCellLocation.getCid();
if (nGSMCID > 0) {
if (nGSMCID != 65535) {
this.cell = nGSMCID;
this.lac = gsmCellLocation.getLac();
}
}
}
TelephonyManager tel = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
CellLocation cel = tel.getCellLocation();
int nPhoneType = tel.getPhoneType();
//电信 CdmaCellLocation
if (nPhoneType == 2 && cel instanceof CdmaCellLocation) {
Log.e("电信", "-----------------》电信");
CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cel;
sid=cdmaCellLocation.getSystemId();
nid=cdmaCellLocation.getNetworkId();
bid=cdmaCellLocation.getBaseStationId();
}
在andorid上面要获取手机网络信息一般要调用TelephonyManagerl类来获取相关信息。
eNB E-UTRAN Node B 为LTE系统中E-UTRAN的组成部分
计算eNB的方式是 ci = eNB*256+cid
获取TelephonyManager + 获取小区信息
telephonymanager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
// 先获取小区信息
// This method was deprecated in API level 23.
// Use (@link getAllCellInfo} which returns a superset of the information from NeighboringCellInfo.
StringBuilder str = new StringBuilder();
//获取小区信息
List<CellInfo> cellInfoList = telephonymanager.getAllCellInfo();
str.append("小区信息:"+"\n");
int index = 0;
for (CellInfo cellInfo : cellInfoList)
{
//获取所有Lte网络信息
if (cellInfo instanceof CellInfoLte)
{
str.append("["+index+"]==CellInfoLte"+"\n");
if(cellInfo.isRegistered()){
str.append("isRegistered=YES"+"\n");
}
str.append("TimeStamp:"+cellInfo.getTimeStamp()+"\n");
str.append(((CellInfoLte)cellInfo).getCellIdentity().toString()+"\n");
str.append(((CellInfoLte)cellInfo).getCellSignalStrength().toString()+"\n");
}
//获取所有的cdma网络信息
if(cellInfo instanceof CellInfoCdma){
str.append("["+index+"]==CellInfoCdma"+"\n");
if(cellInfo.isRegistered()){
str.append("isRegistered=YES"+"\n");
}
str.append("TimeStamp:"+cellInfo.getTimeStamp()+"\n");
str.append(((CellInfoCdma)cellInfo).getCellIdentity().toString()+"\n");
str.append(((CellInfoCdma)cellInfo).getCellSignalStrength().toString()+"\n");
}
//获取所有的Gsm网络
if(cellInfo instanceof CellInfoGsm){
str.append("["+index+"]==CellInfoGsm"+"\n");
if(cellInfo.isRegistered()){
str.append("isRegistered=YES"+"\n");
}
str.append("TimeStamp:"+cellInfo.getTimeStamp()+"\n");
str.append(((CellInfoGsm)cellInfo).getCellIdentity().toString()+"\n");
str.append(((CellInfoGsm)cellInfo).getCellSignalStrength().toString()+"\n");
}
//获取所有的Wcdma网络
if(cellInfo instanceof CellInfoWcdma){
str.append("["+index+"]==CellInfoWcdma"+"\n");
if(cellInfo.isRegistered()){
str.append("isRegistered=YES"+"\n");
}
str.append("TimeStamp:"+cellInfo.getTimeStamp()+"\n");
str.append(((CellInfoWcdma)cellInfo).getCellIdentity().toString()+"\n");
str.append(((CellInfoWcdma)cellInfo).getCellSignalStrength().toString()+"\n");
}
index++;
}
获取手机的位置,实现定位
CellLocation location = telephonymanager.getCellLocation();
if (location != null && location instanceof GsmCellLocation) {
GsmCellLocation l1 = (GsmCellLocation) location;
str.append("使用网络:" + "Gsm" + "\n");
str.append("cid"+l1.getCid()+ "\n");
str.append("lac"+l1.getLac()+ "\n");
str.append("Psc"+l1.getPsc()+ "\n");
} else if(location != null && location instanceof CdmaCellLocation){
CdmaCellLocation l2 = (CdmaCellLocation) location;
str.append(l2.toString() + "\n");
}
注意:getNeighboringCellInfo ()已经被谷歌弃用
文章浏览阅读168次。代码:#include <iostream>#include <cstring> using namespace std;class Student{public:Student(char* pName="no name",int ssId=0){ strncpy(name,pName,40); name[39]='\0'; id = ssId; cout <&..._class student{public:student(char* pname = "no name"){strcpy(name, p
文章浏览阅读2.3k次。ColorPicker一款仿Photoshop取色器的Android版取色器。github地址:ColorPicker前言上一篇已经简单介绍了ColorPicker的项目结构以及两种颜色空间,接下来我们详细解析一下ColorPicker的核心自定义控件ColorPickerView。ColorPickerView在阅读代码之前,我们先看一下ColorPicker的布局以及一些标注的数值在代码里的变量_android 仿ps吸管效果
文章浏览阅读1.2k次,点赞2次,收藏4次。计算机系统结构复习(一):Introduction概述体系结构发展新趋势定量分析/量化研究方法计算机种类摩尔定律什么是计算机系统结构两个概念计算机系统结构与计算机组成、实现的关系体系结构发展新趋势1.新的模型:Data-level parallelism (DLP):数据级并行Thread-level parallelism (TLP):线程级并行Request-level parallelism (RLP):满足用户需求的并行2.开源架构 RISC-V3.Domain-Specific A_data-level parallelism
文章浏览阅读897次。更新你的无线网卡驱动到最新版本15.68.9032.47,重启。或者运行regedit修改注册表 HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\mrvlpcie8897,找到值 “TXAMSDU”把它从1改为0。转载于:https://www.cnblogs.com/misstaste/p/5898571.html..._surface pro 4 无线网卡
文章浏览阅读4.2k次。Chinese_rules.cf的使用方法:下载Chinese_rules.cf,把该规则放在SpamAssassin存放规则的目录(一般在/usr/share/spamassassin或/usr/local/etc/mail/spamassassin)。通过wget下载的命令如下:wget -N -P /usr/share/spamassassin www.service-labs.com/dow_spamassassin 中文规则
文章浏览阅读349次,点赞10次,收藏11次。2.SQL语句可以使用空格/缩进来增强语句的可读性。1.SQL语句可以单行或多行书写,以分号结尾。3.MySQL数据库的SQL语句不区分大小写。
文章浏览阅读5.9k次。Git的相关操作,创建、更新、提交等,代码托管在码云上一、环境配置:(1)下载安装Git Bash,具体步骤就不赘述了;(2)双击运行“Git Bash”,配置用户名及邮箱:$ git config --global user.name "xxxxxxx"$ git config --global user.email "[email protected]"_使用git提交代码,git commit -m ' ' 提交、同步代码之后,在码云上备注是乱码。怎
文章浏览阅读1.4k次。一、数据结构与线程构造方法由于已经看到了ThreadPoolExecutor的源码,因此很容易就看到了ThreadPoolExecutor线程池的数据结构。图1描述了这种数据结构。图1 ThreadPoolExecutor 数据结构其实,即使没有上述图形描述ThreadPoolExecutor的数据结构,我们根据线程池的要求也很能够猜测出其数据结构出来。_线程之 1.7 doacquiresharedinterruptibly解析
文章浏览阅读4.8w次,点赞3次,收藏21次。快速获取图片的宽高其实是为了预先做好排版样式布局做准备,通过快速获取图片宽高的方法比onload方法要节省很多时间,甚至一分钟以上都有可能,并且这种方法适用主流浏览器包括IE低版本浏览器。我们一步一步进入这个过程。一、简陋的获取图片方式1234567891011_图片 src和onload 哪个快
文章浏览阅读6.3k次。严重: 在路径为/book的上下文中,Servlet[jsp]的Servlet.service()引发了具有根本原因的异常java.lang.ClassNotFoundException:这种报错,除了其他人的:还有一种可能:名字不一样,哪怕是空格哪怕是一个空格!..._严重: 在路径为/bookmanage的上下文中,servlet[jsp]的servlet.service()引发了具
文章浏览阅读6.2k次。frida-ios-dump源码地址:GitHub - AloneMonkey/frida-ios-dump: pull decrypted ipa from jailbreak devicefrida-ios-dump是基于frida开发的一键砸壳工具,需要配置frida环境手机配置1)越狱状态2)安装openssh3)安装fridaMac配置1)安装frida,命令行:sudo pip install frida-tools (没有安装pip的话需要先安装pip)_ios砸壳需要 闪退怎么砸
文章浏览阅读2.6k次,点赞3次,收藏2次。1.制作系统应用程序。 ios的程序分为mobile和root权限模式,我们一般用xcode开发的app取得的是mobile权限,但是ios越狱后安装的app如:Cydia、91助手、PP助手等均为系统级应用程序。系统级app的好处是:用不无法手动删除、取得完全的root权限、可设置开机启动项等等功能。通过xcode打包的ipa是无法安装成为系统app的,所以我们需要另外一种打包方式:_depends libundirect.depends firmware