Can't detect NR cells in 5G NSA
3 cases:
- 4G LTE
- 5G NR NSA
- 5G NR SA
In third case: lteCellIsRegistered & nrCellIisRegistered
For case 1 & 2: override type=nr_nsa, lteIsRegistered & !nrIsRegistered so I can't detect differently case 1 from case 2.
Also no nrCell in case 2.
Also nrState=**** (masked)
What to do?
For cases 1&2, what is the value of telephony.networkType? What Android device are you using?
The network type is LTE.. I am using Android 15, but the app will run for Android 14+
Xiaomi RedMi 13 5G.. In G NET Track Pro or in LTE discovery it works fine
Edit: *#*#4636#*#* has continues swaps between LTE cell information & NR cell information.. continues - continues also from there I can see that is connected in both LTE & NR cells (case NSA)..
Can you try this on a phone of a different brand? Basically cases 1 and 2 should be differentiable by the networkType (LTE vs NR). My guess is that Xiaomi's customisations to the OS have broken it, and networkType is just being set incorrectly. But it could also be that the specific network you're connected is odd in some way (what country + network is it?). So, if you could try the same SIM card in a different 5G-capable phone then we could potentially work out which of those cases is true. I'm afraid it doesn't look hopeful that we'd be able to solve this though...
I have found how G net track pro retrieves the cells:
fun getNeighboringCellInfoGemini(slotIndex: Int): List<Any>? {
val telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
return try {
val method = telephonyManager.javaClass
.getMethod("getNeighboringCellInfoGemini", Int::class.javaPrimitiveType)
val result = method.invoke(telephonyManager, slotIndex)
result as? List<Any>
} catch (e: Exception) {
e.printStackTrace()
throw RuntimeException("getNeighboringCellInfoGemini failed")
}
}
Can you test this code please because I am in my village and I can't test it right now
I suspect this is a method from Xiaomi's OS customisations. No idea what the return types would mean. Doesn't seem to be documented anywhere.
I found the solution: in 5G NSA the LTE registered cell has information about NR. So if you request NR strength and return value that means 5G NSA. Thanks