Я хочу получить некоторую информацию из сервисного режима телефона в приложение.Пример
У меня есть разрешение.Какой самый простой способ получить информацию о режиме обслуживания в переменные?(Идентификатор ячейки Lac и т. Д. Для LTE WCDMA и LTE)
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellList = telephonyManager.getAllCellInfo();
if (cellList != null) {
for (final CellInfo cell : cellList) {
if (cell instanceof CellInfoGsm) {
CellInfoGsm cellInfoGsm = (CellInfoGsm) cell;
int a = (cellInfoGsm.getCellIdentity().getLac());
TextView textviewdupka = (TextView) findViewById(R.id.textViewdupka);
textviewdupka.setText("cid: "+a);
} else if (cell instanceof CellInfoLte) {
Toast.makeText(this, "LTE", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(this, "other", Toast.LENGTH_SHORT).show();
}
}
}else{
Toast.makeText(this, "null CellList", Toast.LENGTH_SHORT).show();
}
прямо сейчас telephonyManager.getAllCellInfo () возвращает ноль для этого примера.