I'm using requestCellInfoUpdate() callback to get the latest cell info results. It is working fine in Android version Q and above but when I use it in versions below 10, the app crashes. My goal is to continuously get the latest cell info results in all Android versions. Looking forward to your response. It is extremely important for me. Thanks!
telephonyManager.requestCellInfoUpdate(this.getMainExecutor(), new TelephonyManager.CellInfoCallback() {
@Override
public void onCellInfo(@NonNull List<CellInfo> cellInfos) {
Toast.makeText(MainActivity.this, "Helsinki", Toast.LENGTH_SHORT).show();
cellInfoList.clear();
for (int i = 0; i < cellInfos.size(); i++) {
CellInfo cellInfo = cellInfos.get(i);
if (cellInfo.isRegistered())
cellInfoList.add(cellInfo);
}
bindValues();
}
});