-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override Network Showing LTE-CA, when isUsingCarrierAggregation is false #47
Comments
I get the Override Network from the @RequiresApi(api = Build.VERSION_CODES.S)
private static class OverrideNetworkTypeListener extends TelephonyCallback implements TelephonyCallback.DisplayInfoListener
{
int overrideNetworkType = -1;
@Override
public void onDisplayInfoChanged(@NonNull TelephonyDisplayInfo telephonyDisplayInfo)
{
overrideNetworkType = telephonyDisplayInfo.getOverrideNetworkType();
}
} And of course to register it:
As far as when the service provider decides to tell the phone it is I should add a spot in the NS display where it shows the result of |
Well this is annoying. I went to go use the I have parsed the toString result before, so I will probably just do that again. But that is less than ideal. |
Yep, that's what I had to do - here's the (kotlin) code if it helps @RequiresApi(Build.VERSION_CODES.R)
fun collectNetworkRegistrationInfo(context: Context): NetworkRegistrationData? {
val telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
return null
}
telephonyManager.serviceState?.networkRegistrationInfoList?.forEach { regInfo ->
val regInfoString = regInfo.toString()
val dataSpecificString = getStringBetweenStrings(regInfoString, "DataSpecificRegistrationInfo { ", "}")
?: getStringBetweenStrings(regInfoString, "DataSpecificRegistrationInfo :{ ", "}")
val nrStateString = getStringBetweenStrings(regInfoString, "nrState=", " ")
?: "UNKNOWN" // Fallback to "UNKNOWN" if parsing fails or `nrState=` is not followed by a space
dataSpecificString?.let {
try {
val dataMap = parseDataSpecificString(it)
val nrState = nrStateString
if (dataMap.isNotEmpty()) {
return NetworkRegistrationData(
domain = regInfo.domain.toString(),
transportType = regInfo.transportType.toString(),
accessNetworkTechnology = regInfo.accessNetworkTechnology.toString(),
availableServices = regInfo.availableServices.map { it.toString() },
dataSpecificInfo = DataSpecificRegistrationInfo(
maxDataCalls = dataMap["maxDataCalls"]?.toIntOrNull() ?: 0,
isDcNrRestricted = dataMap["isDcNrRestricted"]?.toBoolean() ?: false,
isNrAvailable = dataMap["isNrAvailable"]?.toBoolean() ?: false,
isEnDcAvailable = dataMap["isEnDcAvailable"]?.toBoolean() ?: false,
lteVopsSupport = dataMap["lteVopsSupport"]?.toIntOrNull() ?: 0,
emcBearerSupport = dataMap["emcBearerSupport"]?.toIntOrNull() ?: 0,
isUsingCarrierAggregation = dataMap["isUsingCarrierAggregation"]?.toBoolean() ?: false
),
nrState = nrState
)
}
} catch (e: Exception) {
Log.e("TgSdkMeasurementManager", "Error parsing DataSpecificInfo: ${e.message}")
}
}
}
return null
}
private fun getStringBetweenStrings(fullString: String, start: String, end: String): String? {
val startIndex = fullString.indexOf(start) + start.length
val endIndex = if (end == " ") fullString.indexOf(' ', startIndex) else fullString.indexOf(end, startIndex)
if (startIndex < start.length || endIndex == -1) return null
return fullString.substring(startIndex, endIndex).trim()
}
private fun parseDataSpecificString(dataString: String): Map<String, String> {
return dataString.replace(" = ", "=")
.split(" ")
.mapNotNull { it.split("=").takeIf { splitResult -> splitResult.size == 2 } }
.associate { it[0] to it[1] }
} |
@pt-at-tg , Do you ever see |
Hmm, I think you're right. Over the July data set where we have access to phone state these are the figures
My Pixel never goes to 4G+ but I suspect Google don't play those games. I have an Oppo, and I do know an area where I've seen 4G+ on EE in London, so I'll confirm if the value is false there anyway |
Hi Christian, love the app - how are you making the calculation for Override Network, specifically for LTE-CA. I've got an (internal) app for Teragence which exposes the NetworkRegistrationInfo.DataSpecificInfo and "isUsingCarrierAggregation" is "false", but on NetworkSurvey the Override Network is LTE-CA.
(And btw, totally agree with your info message about Override Network...total scam!)
The text was updated successfully, but these errors were encountered: