Android在NR情况下获取5G的rsrp,rsrq和ssnr,pci和ci值。
TelephonyManager tm = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> allCellInfo = tm.getAllCellInfo();
if (allCellInfo != null && allCellInfo.size() > 0) { for (int i = 0; i < allCellInfo.size(); i++) { CellInfo info = allCellInfo.get(i); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { //5G if (info instanceof CellInfoNr) { CellIdentityNr nr = (CellIdentityNr) ((CellInfoNr) info).getCellIdentity(); int pci = nr.getPci(); long ci = nr.getNci(); CellSignalStrengthNr nrStrength = (CellSignalStrengthNr) ((CellInfoNr) info).getCellSignalStrengt now_rsrp = "-" + nrStrength.getSsRsrp() + ""; String s = ((CellInfoNr)CellInfoNr info).toString(); } } } }