is Success Ping In Thread - Android Network

Android examples for Network:Ping

Description

is Success Ping In Thread

Demo Code


//package com.java2s;

public class Main {

    public static boolean isSuccessPingInThread() {
        try {/*  www .ja v  a  2s  .  c o  m*/
            Process p = Runtime.getRuntime().exec(
                    "/system/bin/ping -c 3 www.googles.com");
            int status = p.waitFor();
            if (status == 0) {
                return true;
            } else {
                return false;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }
}

Related Tutorials