移动基站问题

1.获取附近基站的信息:

package myapplication.com.myapp.activity;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.CellInfo;
import android.telephony.CellInfoCdma;
import android.telephony.CellInfoGsm;
import android.telephony.CellInfoLte;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import myapplication.com.myapp.R;
import myapplication.com.myapp.adapter.MyAdapter;
import myapplication.com.myapp.entity.jizhanBean;

public class JizhanFujin_Activity extends AppCompatActivity {

    TelephonyManager telephonyManager;
    List<jizhanBean> datas;
    ListView listView;
    ImageView image_back;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jizhan_fujin);
        initview();
        List<CellInfo> cellInfoList = telephonyManager.getAllCellInfo();

        if(cellInfoList.size()>0){
            for (CellInfo cellInfo : cellInfoList) {
        // 这里输出附近基站信息<1> System.out.println(
"*****@ALL"+cellInfo.toString()); }
        // 判断GSM基站信息
if(cellInfo instanceof CellInfoGsm){ } } } } } public void initview(){ datas=new ArrayList<>(); listView= (ListView) findViewById(R.id.listview); telephonyManager = (TelephonyManager) JizhanFujin_Activity.this.getSystemService(Context.TELEPHONY_SERVICE); image_back= (ImageView) findViewById(R.id.image_back); image_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } /** * * */ // String operator = telephonyManager.getNetworkOperator(); // /**通过operator获取 MCC 和MNC */ // int mcc = Integer.parseInt(operator.substring(0, 3)); // int mnc = Integer.parseInt(operator.substring(3)); // GsmCellLocation location = (GsmCellLocation) telephonyManager.getCellLocation(); // // // /**通过GsmCellLocation获取中国移动和联通 LAC 和cellID */ // int lac = location.getLac(); // int cellid = location.getCid(); // // 开始************* // StringBuilder str = new StringBuilder(); /* * * * * **/ }

2.

<1>输出附近所有信息为:

这里有个mRegistered=YES 表示当前服务基站?

<2>

LTE物理小区标识(PCI): 0-503
GSM Cell ID (CI): 0-65535
PCI:  物理小区标识,用来区分来自不同LTE小区的信号,类似UMTS中的PCS。
CI: 小区标识,网络中小区的编号,与MCC,MNC及LAC号组合得到小区全球识别码,用来在全球范围内唯一识别某一小区。

MCC:移动国家号码,由3位数字组成,唯一地识别移动用户所属的国家。我国为460。

MNC:移动网号,由两位数字组成,用于识别移动用户所归属的移动网。在移动为00,联通为01

<2>

TAC LTE的追踪区

LAC GSM的位置区
一般LTE的TAC配置的就是区域内GSM的LAC,如果配置不一致会导致呼叫失败无法接通

<MCC,MNC为固定值那么这里LAC用于区分标示基站唯一标示的话,见下面的输出信息:只有当mRegistered=YES时才能得到TAC,那样怎么得到附近所有基站标示?>

       PCI:504个PCI分成168组,每组包含连续的3个PCI, 同eNodeB的三个小区的PCI要求来自同一组,全网复用。
       CI:  没有特殊限制条件,可在0-65535中任意取值,但在同一个LAC下不能重复。

<!--而 if(cellInfo instanceof CellInfoCdma)代码这里,能找到cellinfoLTE,CDMA,GSM,却找不到移动的TD-SCDMA?-->


  CellInfoLte:{mRegistered=YES mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=460 mMnc=0 mCi=219105291 mPci=133 mTac=20951}CellSignalStrengthLte: ss=23 rsrp=-93 rsrq=-6 rssnr=2147483647 cqi=2147483647 ta=2147483647}
  CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=127 mTac=2147483647}CellSignalStrengthLte: ss=12 rsrp=-104 rsrq=-4 rssnr=2147483647 cqi=2147483647 ta=2147483647}
 CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=44 mTac=2147483647} CellSignalStrengthLte: ss=12 rsrp=-126 rsrq=-20 rssnr=2147483647 cqi=2147483647 ta=2147483647}
  CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=241 mTac=2147483647} CellSignalStrengthLte: ss=18 rsrp=-92 rsrq=-5 rssnr=2147483647 cqi=2147483647 ta=2147483647}
   CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=0 mTac=2147483647} CellSignalStrengthLte: ss=31 rsrp=0 rsrq=0 rssnr=2147483647 cqi=2147483647 ta=2147483647}
   CellInfoGsm:{mRegistered=YES mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=38417} CellSignalStrengthGsm: ss=13 ber=99}
  CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=38411} CellSignalStrengthGsm: ss=16 ber=99}
  CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=38413} CellSignalStrengthGsm: ss=18 ber=99}
 CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=46942} CellSignalStrengthGsm: ss=13 ber=99}
  CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=3115} CellSignalStrengthGsm: ss=16 ber=99}
  CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=0 mMnc=0 mLac=0 mCid=-1} CellSignalStrengthGsm: ss=12 ber=99}
  CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=11562} CellSignalStrengthGsm: ss=11 ber=99}
  

 3.是不是有其他什么方法实现?能够得到附近基站的标识?

 
今天多一点积累,明天少一分烦恼
原文地址:https://www.cnblogs.com/galibujianbusana/p/6093686.html