I want to be able to get a user internet connection. I have tried
boolean connected = false;
try {
ConnectivityManager cm = (ConnectivityManager)getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo nInfo = cm.getActiveNetworkInfo();
connected = nInfo != null && nInfo.isAvailable() && nInfo.isConnected();
return connected;
} catch (Exception e) {
Log.e("Connectivity Exception", e.getMessage());
}
return connected;
But this only gets mobile data and wifi connection status, if the user has an expired data plan or doesn't even have any data plan I will not be able to know. I want to know the internet status before making a server call instead of making a server and running in a runout time error.
Please help I have checked stack overflow, but I keep getting the same answer.