I am trying to detect Cellular signals without an installed SIM card. The phone I'm using is a Motorola Nexus 6. And the code I am using is below -
tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cInfoList = tm.getAllCellInfo();
for (final CellInfo info : cInfoList) {
if (info instanceof CellInfoGsm)
sR = "GSM: " + gsm.toString() + "\n" + ((CellInfoGsm) info).getCellIdentity();
else if (info instanceof CellInfoCdma)
sR = "CDMA: " + cdma.toString() + "\n" + ((CellInfoCdma) info).getCellIdentity();
else if (info instanceof CellInfoLte)
sR = "LTE: " + lte.toString() + "\n" + ((CellInfoLte) info).getCellIdentity();
else if (info instanceof CellInfoWcdma)
sR = "WCDMA: " + wcdma.toString() + "\n" + ((CellInfoWcdma) info).getCellIdentity();
When the SIM slot is empty, cInfoList contains only objects of CellInfoGsm and CellInfoWcdma, which are 3G. If I insert a SIM card and let it connect, then cInfoList contains only instances of CellInfoLte, which is 4G.
Can you explain me why I cannot detect LTE cell networks without a SIM card and why I cannot detect 3G networks with a SIM card?