I used the following code to get the signal strength,
SignalStrengthListener signalStrengthListener; signalStrengthListener = new SignalStrengthListener(); ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)).listen( signalStrengthListener, SignalStrengthListener.LISTEN_SIGNAL_STRENGTHS);
and then he listens to the strength of the signal,
private class SignalStrengthListener extends PhoneStateListener { @Override public void onSignalStrengthsChanged( android.telephony.SignalStrength signalStrength) {
This works well if the sim is present on the device. But when I remove the simulator from the device, and then check the signal level, it still gives some value for the signal strength.
One of the possible solutions that I can think of is to first check if the SIM device is present in the device or not, and then show the signal strength. But I would like to know an explanation of this strange behavior and a possible solution for it.
source share