Android Ping ICMP suggest change

Performs a single Ping

This example attempts a single Ping request. The ping command inside the runtime.exec method call can be modified to any valid ping command you might perform yourself in the command line.

try {
    Process ipProcess = runtime.exec("/system/bin/ping -c 1 8.8.8.8");
    int exitValue = ipProcess.waitFor();
    ipProcess.destroy();
    
    if(exitValue == 0){
        // Success
    } else { 
        // Failure
    }
} catch (IOException | InterruptedException e) {
    e.printStackTrace();
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents