I have 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 it is listening for the Signal strength,
private class SignalStrengthListener extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(
android.telephony.SignalStrength signalStrength) {
// get the signal strength (a value between 0 and 31)
int strengthAmplitude = signalStrength.getGsmSignalStrength();
// do something with it (in this case we update a text view)
// signalStrengthText.setText(String.valueOf(strengthAmplitude));
if (strengthAmplitude > 30) {
signalStrengthText.setText("Good");
// signalStrengthText.setTextColor(getResources().getColor(R.color.good));
} else if (strengthAmplitude > 20 && strengthAmplitude < 30) {
signalStrengthText.setText("Average");
// signalStrengthText.setTextColor(getResources().getColor(R.color.average));
} else if (strengthAmplitude < 20) {
signalStrengthText.setText("Weak");
// signalStrengthText.setTextColor(getResources().getColor(R.color.weak));
}
super.onSignalStrengthsChanged(signalStrength);
}
}
It works good if the sim is present in the device. But when I remove the sim from the device and then check for the signal strength, it still provides some value for the signal strength.
One possible solution, I can think of is to first check, if the sim is present in the device or not and then show the signal strength. But I would like to know an explanation for this weird behaviour and a possible solution for it.
Your phone has an in-built radio transmitter and receiver capable of transmitting and receiving signals even without a SIM card. The SIM card only identifies you to a particular service provider to whom you have subscribed for mobile services.
It's in the connections menu. On some phones, this may say "Mobile Networks" or "Cellular Networks" depending on the make and model of your phone and what version of Android you are using. Tap Network Operators. It's generally the last option in the Networks menu.
Generally your SIM card doesn't directly affect how well your cellphone can pick up a signal, but a bad SIM card might prevent you from connecting to the network at all. If you have certain SIM cards, you may not be able to connect to all the services your carrier offers.
If your phone show full bars but have no service, check with your carrier. It most likely has something to do with the provided services. Alternatively, try fixing the problem by restarting the device, enabling and disabling Airplane mode, or resetting Network Settings.
no USIM is required for cell service - only for authentication. else emergency calls would fail.
it's not weird at all... that is common sense, since you do not remove the radio nor disable it.
a simple test: remove the USIM, call emergency services, pretend you were pocket dialing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With