How to find Sim Network available or not?
I don't want to check internet connection..but I want to check simcard is availble but simcard network is available or not
It is possible to find sim available(Sim State) in simslot . And also mobile internet available or not . But please give me suggestion of how to find network of sim-card is available or not in android programmatically .
Check out below code it will provide you signal strength of mobile network:
Define Variables:
TelephonyManager mTelephonyManager;
MyPhoneStateListener mPhoneStatelistener;
int mSignalStrength = 0;
Then add this class to your code:
class MyPhoneStateListener extends PhoneStateListener {
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
mSignalStrength = signalStrength.getGsmSignalStrength();
mSignalStrength = (2 * mSignalStrength) - 113; // -> dBm
}
}
and in your onCreate method use:
mPhoneStatelistener = new MyPhoneStateListener();
mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mTelephonyManager.listen(mPhoneStatelistener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
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