|
|
|
@ -29,17 +29,4 @@ public class NetCheck {
|
|
|
|
|
return "当前连接到未知网络";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static boolean isOnline(){
|
|
|
|
|
Runtime runtime = Runtime.getRuntime();
|
|
|
|
|
try {
|
|
|
|
|
Process ipProcess = runtime.exec("ping -c 3 cn.bing.com");
|
|
|
|
|
int exitValue = ipProcess.waitFor();
|
|
|
|
|
Log.i("Avalible", "Process:"+exitValue);
|
|
|
|
|
return (exitValue == 0);
|
|
|
|
|
} catch (IOException | InterruptedException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|