I need to get accurate LTE PCI readings, not the neighbors, just the PCI (Physical Cell Id) that the phone is attached to. My current implementation is using the Android telephony and telephony manager, as seen in the class below:
protected class SignalStrengthListener extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(android.telephony.SignalStrength signalStrength) {
tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
ltestr = signalStrength.toString();
parts = ltestr.split(" ");
try {
cellInfoList = tm.getAllCellInfo();
for (CellInfo cellInfo : cellInfoList) {
if (cellInfo instanceof CellInfoLte) {
// cast to CellInfoLte and call all the CellInfoLte methods you need
// Gets the LTE PCI: (returns Physical Cell Id 0..503, Integer.MAX_VALUE if unknown)
cellPci = ((CellInfoLte) cellInfo).getCellIdentity().getPci();
}
}
} catch (Exception e) {
Log.d("SignalStrength", "Exception: " + e.getMessage());
}
super.onSignalStrengthsChanged(signalStrength);
}
}
The problem with this implementation is described in another question I posted: Android CellIdentityLte PCI readings are inaccurate, why? Can anything be done?
I have heard of other telephony apps that use reflection to gather accurate LTE parameters, but I have no idea how something like this is done. So, how can I use reflection in an app to get PCI readings?
Thanks and cheers!
Aucun commentaire:
Enregistrer un commentaire