4

I'm trying to get the information of the cell tower connected to the phone in the Android studio. This is my code:

    telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);

    List<CellInfo> cellInfos = telephonyManager.getAllCellInfo();
    for (CellInfo cellInfo:cellInfos){
        if (cellInfo instanceof CellInfoGsm){
            textViewCellular.append("\n\nType: GSM");
            textViewCellular.append("\nCell Identity:\n\tCID:" + ((CellInfoGsm) cellInfo).getCellIdentity().getCid());
            textViewCellular.append("\n\tLAC:" + ((CellInfoGsm) cellInfo).getCellIdentity().getLac());
            textViewCellular.append("\n\tMCC:" + ((CellInfoGsm) cellInfo).getCellIdentity().getMcc());
            textViewCellular.append("\n\tMNC:" + ((CellInfoGsm) cellInfo).getCellIdentity().getMnc());
            textViewCellular.append("\nSignal Strength:" + ((CellInfoGsm) cellInfo).getCellSignalStrength().getDbm() + "dBm");
        }
    }

But, running the code on my mobile gives me the same value: CID = LAC = MCC = MNC = Signal strength = 2147483647 Is there any explanation for this?

Osama El-Ghonimy
  • 335
  • 2
  • 12

0 Answers0