//return true if the application can access the internet
private static boolean haveInternet(Context context) {
NetworkInfo info = ((ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
if (info == null || !info.isConnected())
{
return false;
}
if (info.isRoaming()) {
return true;
}
return true;
}
No comments:
Post a Comment