Commit fa2349ea authored by narinder Rana's avatar narinder Rana
Browse files

refine code

parent be619999
Pipeline #139789 passed with stage
in 3 minutes and 12 seconds
......@@ -26,14 +26,6 @@ public class ConnectivityReceiver
}
public static boolean isConnected() {
// ConnectivityManager
// cm = (ConnectivityManager) MyApplication.getInstance().getApplicationContext()
// .getSystemService(Context.CONNECTIVITY_SERVICE);
// NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
//
// return activeNetwork != null
// && activeNetwork.isConnectedOrConnecting();
try {
String command = "ping -c 1 ecloud.global";
return Runtime.getRuntime().exec(command).waitFor() == 0;
......@@ -43,17 +35,6 @@ public class ConnectivityReceiver
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
......@@ -70,7 +51,7 @@ public class ConnectivityReceiver
isConnected = activeNetwork != null
&& activeNetwork.isConnectedOrConnecting();
Log.e(TAG, "connectivityReceiverListener...isConnected." + isConnected());
Log.e(TAG, "connectivityReceiverListener...." + isConnected());
if (connectivityReceiverListener != null) {
connectivityReceiverListener.onNetworkConnectionChanged(isConnected);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment