Код: Выделить всё
int nrState = regInfo.getNrState();«Невозможно разрешить метод getNrState в NetworkRegistrationInfo»
Может ли кто-нибудь допустить ошибку? Или мне следует сделать это по-другому?
Код: Выделить всё
ServiceState serviceState = telephonyManager.getServiceState();
if (serviceState != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
for (NetworkRegistrationInfo regInfo : serviceState.getNetworkRegistrationInfoList()) {
if (regInfo.getAccessNetworkTechnology() == TelephonyManager.NETWORK_TYPE_NR) {
**int nrState = regInfo.getNrState();**
switch (nrState) {
case NetworkRegistrationInfo.NR_STATE_NONE:
return "Not in NR state";
case NetworkRegistrationInfo.NR_STATE_RESTRICTED:
return "Restricted NR state";
case NetworkRegistrationInfo.NR_STATE_NOT_RESTRICTED:
return "Non-restricted NR state";
case NetworkRegistrationInfo.NR_STATE_CONNECTED:
return "Connected to 5G NR";
}
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... getnrstate