What is the correct way of checking if a mobile network (GSM) connection is available on Android? (>2.1) I don\'t want to check if there is data connection available over the mo
I used the following code to know if I'm connected to the network (no mobile data):
public static Boolean isMobileAvailable(Context appcontext) {
TelephonyManager tel = (TelephonyManager) appcontext.getSystemService(Context.TELEPHONY_SERVICE);
return ((tel.getNetworkOperator() != null && tel.getNetworkOperator().equals("")) ? false : true);
}
The NetworkOperator is returned only if the phone is actually registered to a network.