NetworkTypeDetector icon indicating copy to clipboard operation
NetworkTypeDetector copied to clipboard

Can't detect NR cells in 5G NSA

Open cpappas-mobeetest opened this issue 8 months ago • 6 comments

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?

cpappas-mobeetest avatar May 02 '25 22:05 cpappas-mobeetest

For cases 1&2, what is the value of telephony.networkType? What Android device are you using?

tdcolvin avatar May 03 '25 01:05 tdcolvin

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)..

cpappas-mobeetest avatar May 03 '25 03:05 cpappas-mobeetest

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...

tdcolvin avatar May 03 '25 07:05 tdcolvin

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

cpappas-mobeetest avatar May 03 '25 10:05 cpappas-mobeetest

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.

tdcolvin avatar May 13 '25 07:05 tdcolvin

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

cpappas-mobeetest avatar May 13 '25 07:05 cpappas-mobeetest