Created
March 28, 2011 13:25
-
-
Save mstefanko/890440 to your computer and use it in GitHub Desktop.
Can app access internet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*@return boolean return true if the application can access the internet | |
*/ | |
private boolean haveInternet(){ | |
NetworkInfo info=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE).getActiveNetworkInfo(); | |
if(info==null || !info.isConnected()){ | |
return false; | |
} | |
if(info.isRoaming()){ | |
//here is the roaming option you can change it if you want to disable internet while roaming, just return false | |
return true; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment