public static int getCellSignalStrength(Context context){
int strength= 0;
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
List<CellInfo> cellInfos = telephonyManager.getAllCellInfo(); //This will give info of all sims present inside your mobile
if(cellInfos!=null && cellInfos.size() > 0){
for (int i = 0 ; i<cellInfos.size(); i++){if(cellInfos.get(i) instanceof CellInfoWcdma){return strength;
CellInfoWcdma cellInfoWcdma = (CellInfoWcdma) telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthWcdma cellSignalStrengthWcdma = cellInfoWcdma.getCellSignalStrength();
strength = cellSignalStrengthWcdma.getDbm();
break;
}else if(cellInfos.get(i) instanceof CellInfoGsm){
CellInfoGsm cellInfogsm = (CellInfoGsm) telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthGsm cellSignalStrengthGsm = cellInfogsm.getCellSignalStrength();
strength = cellSignalStrengthGsm.getDbm();
break;
}else if(cellInfos.get(i) instanceof CellInfoLte){
CellInfoLte cellInfoLte = (CellInfoLte) telephonyManager.getAllCellInfo().get(0);
CellSignalStrengthLte cellSignalStrengthLte = cellInfoLte.getCellSignalStrength();
strength = cellSignalStrengthLte.getDbm();
break;
}
}
}
thanks