Loading app/src/main/java/foundation/e/drive/receivers/ConnectivityReceiver.java +1 −20 Original line number Original line Diff line number Diff line Loading @@ -26,14 +26,6 @@ public class ConnectivityReceiver } } public static boolean isConnected() { public static boolean isConnected() { // ConnectivityManager // cm = (ConnectivityManager) MyApplication.getInstance().getApplicationContext() // .getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); // // return activeNetwork != null // && activeNetwork.isConnectedOrConnecting(); try { try { String command = "ping -c 1 ecloud.global"; String command = "ping -c 1 ecloud.global"; return Runtime.getRuntime().exec(command).waitFor() == 0; return Runtime.getRuntime().exec(command).waitFor() == 0; Loading @@ -43,17 +35,6 @@ public class ConnectivityReceiver return false; return false; } } public boolean isConecctedToInternet() { Runtime runtime = Runtime.getRuntime(); try { Process ipProcess = runtime.exec("/system/bin/ping -c 1 8.8.8.8"); int exitValue = ipProcess.waitFor(); return (exitValue == 0); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return false; } @Override @Override Loading @@ -70,7 +51,7 @@ public class ConnectivityReceiver isConnected = activeNetwork != null isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); && activeNetwork.isConnectedOrConnecting(); Log.e(TAG, "connectivityReceiverListener...isConnected." + isConnected()); Log.e(TAG, "connectivityReceiverListener...." + isConnected()); if (connectivityReceiverListener != null) { if (connectivityReceiverListener != null) { connectivityReceiverListener.onNetworkConnectionChanged(isConnected); connectivityReceiverListener.onNetworkConnectionChanged(isConnected); } } Loading Loading
app/src/main/java/foundation/e/drive/receivers/ConnectivityReceiver.java +1 −20 Original line number Original line Diff line number Diff line Loading @@ -26,14 +26,6 @@ public class ConnectivityReceiver } } public static boolean isConnected() { public static boolean isConnected() { // ConnectivityManager // cm = (ConnectivityManager) MyApplication.getInstance().getApplicationContext() // .getSystemService(Context.CONNECTIVITY_SERVICE); // NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); // // return activeNetwork != null // && activeNetwork.isConnectedOrConnecting(); try { try { String command = "ping -c 1 ecloud.global"; String command = "ping -c 1 ecloud.global"; return Runtime.getRuntime().exec(command).waitFor() == 0; return Runtime.getRuntime().exec(command).waitFor() == 0; Loading @@ -43,17 +35,6 @@ public class ConnectivityReceiver return false; return false; } } public boolean isConecctedToInternet() { Runtime runtime = Runtime.getRuntime(); try { Process ipProcess = runtime.exec("/system/bin/ping -c 1 8.8.8.8"); int exitValue = ipProcess.waitFor(); return (exitValue == 0); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return false; } @Override @Override Loading @@ -70,7 +51,7 @@ public class ConnectivityReceiver isConnected = activeNetwork != null isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); && activeNetwork.isConnectedOrConnecting(); Log.e(TAG, "connectivityReceiverListener...isConnected." + isConnected()); Log.e(TAG, "connectivityReceiverListener...." + isConnected()); if (connectivityReceiverListener != null) { if (connectivityReceiverListener != null) { connectivityReceiverListener.onNetworkConnectionChanged(isConnected); connectivityReceiverListener.onNetworkConnectionChanged(isConnected); } } Loading