OnePlus 8T 5G NSA模式下无法通过Telephony获取NR信号强度问询
如何在OnePlus 8T 5G的NSA模式下获取NR的ss-rsrp和ss-rsrq值?
我尝试获取处于5G NSA模式设备的CellSignalStrength,该模式需同时涉及LTE和NR,因此希望获取两者的信号强度,但不同设备表现不一致:
- OPPO A78 5G(ColorOS,Android 13)可正常获取LTE和NR信号强度;
- OnePlus 8T 5G(OxygenOS,Android 13)虽确认处于5G NSA模式,但仅能获取CellSignalStrengthLTE。
令我困惑的是,Play Store上部分应用可在OnePlus 8T 5G上捕获NR信号强度。
*补充:开启5G SA模式时,两台设备均可正常工作。
我使用Telephony框架获取CellSignalStrength,代码片段如下:
fun requestCellInfoUpdate() { //Get the system's TelephonyManager service. mTelephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager //Create a TelephonyManager instance for the default subscription ID. (Current Data SIM) mTelephonyManager = mTelephonyManager.createForSubscriptionId(getDefault_SubscriptionId(context)) //Request cell info update (Android Q). The result will be handled by the provided callback. mTelephonyManager.requestCellInfoUpdate(context.mainExecutor, object : TelephonyManager.CellInfoCallback() { override fun onCellInfo(cellInfo: MutableList<CellInfo>) { // Find the currently registered cell from the list. val servingCell = cellInfo.find { it.isRegistered} // If a registered cell is found for serving cellular, update the cachedCellInfo list. if (servingCell != null) { cachedCellInfo = listOf(servingCell) } } //Callback method when there's an error retrieving cell info. override fun onError(errorCode: Int, detail: Throwable?) { super.onError(errorCode, detail) // Handle the error as needed. For example, log the error or display an error message. } }) } fun getInfo(): List<String> { //Request the current cell information. requestCellInfoUpdate() // Update Cell Information on return to `cachedCellInfo` var cellId: String var cellSignalStrength: String var telephonyList: List<String> = emptyList() //Check if the cached cell information is available. if (cachedCellInfo.isEmpty()) { // If not available, set error messages indicating the GPS needs to be on. cellId = "Error! GPS must be turned on." cellSignalStrength = "Error! GPS must be turned on." } else { //Extract cell identity and signal strength from the cached information. cellId = cachedCellInfo[0].cellIdentity.toString() // index 0 to get only Serving Cell data cellSignalStrength = cachedCellInfo[0].cellSignalStrength.toString() // index 0 to get only Serving Cell data } //Add the extracted cell identity and signal strength to the result list. telephonyList += cellId // index [i] telephonyList += cellSignalStrength // index [i+1] return telephonyList }
鉴于设备处于5G NSA模式,我本应获取LTE和NR的信号强度,但如前所述,OnePlus 8T 5G仅返回LTE信号强度。我最初以为是硬件限制,但因其他应用可在该设备上捕获NR信号强度,故认为存在可行方案。恳请提供在5G NSA模式下准确捕获ss-rsrp和ss-rsrq值的指导。
内容的提问来源于stack exchange,提问作者Thanawit Thampakorn
相关产品推荐
相关产品推荐

