mroczis / netmonster-core

Android Telephony SDK bridge with some additional features
Apache License 2.0
343 stars 73 forks source link

NR cells not detected when on NR-NSA (non-dedicated mode) #15

Closed Chris-Wimtech closed 3 years ago

Chris-Wimtech commented 3 years ago

As the title suggests.

What I've been able to determine is the issue seems to be because you're not reading the NR cell given by TelephonyManager.getSignalStrength().getSignalStrengths(CellSignalStrengthNr.class).

That, from my own experience, appears to be the only place where the phone will report values for the NR cell in this circumstance, and even though it doesn't contain any identifiers, I would consider it better to include a cell from this source in any situation where you can detect a 5G connection state and no other NR cell available from other sources.

I have tried to use this together with the CellIdentities stored internally by ServiceState but have had mixed results, but who knows, maybe you might have an idea to get it working.

Chris-Wimtech commented 3 years ago

A bit of an update here:

This is actually really weird. When I do TelephonyManager.getSignalStrength directly, it seems to have the NrSignalStrength, but when I get it via netmonster's ITelephonyCompat.getSignalStrength, it does not.

mroczis commented 3 years ago

This source is already used in NetMonster Core. For more info refer to SignalStrengthMapper.kt.

ITelephonyCompat.getSignalStrength is just a method backporting synchronous access to an instance of SignalStrength. This was originally added in Android P. It does not necessarily need to return the same data. Depends on the phone.

Chris-Wimtech commented 3 years ago

Sorry! Sorry!

Took a while to get back to this. It turns out it was my mistake. There was a bug in the code where it read the netmonster objects to my own and wasn't handling nulls for the Dbm value.

Fixed that and I see the NR is coming through from netmonster.