Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //THIS:
- public boolean verifyInternetConnection(Context context) {
- try {
- Process p1 = java.lang.Runtime.getRuntime().exec("ping -c 1 www.google.com");
- int returnVal = p1.waitFor();
- boolean reachable = (returnVal==0);
- return reachable;
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return false;
- }
- //TO THIS:
- public boolean verifyInternetConnection(Context context) {
- try {
- return (java.lang.Runtime.getRuntime().exec("ping -c 1 www.google.com").waitFor()==0);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment