Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ping the server in Android?

How can I ping some web server in Android to test if I've Internet connection? So I need the method which pings the given site and returns false if I've no Internet and true if I have.

like image 249
user2543953 Avatar asked Jul 05 '13 16:07

user2543953


People also ask

How do I ping a server from my phone?

Using Ping App Grab your smartphone, and launch the Ping app. If you haven't installed the app yet please go to Play Store and download it first. Then tap the start button. Wait for a second and you will see the results of the data connection on your Android smartphone screen.

How do I ping an app server?

You can Ping your application server from anywhere as long as you know its IP address. From within your network, find the network IP address of the application server. Just give that IP address with the Ping command, for example, ping 192.168. 0.20.

Can we ping from mobile?

Much like iOS, the Android operating system does not come with a way to ping other routers or servers by default. Luckily, there are many apps available on Google Play Store that will allow you to do this. Some of the apps you can use include “Ping,” “Ping & Net,” and “PingTools Network Utilities.”


1 Answers

See this method, it's the best way to check for connectivity to a given server:

http://developer.android.com/reference/java/net/InetAddress.html#isReachable(int)

like image 90
ognian Avatar answered Oct 28 '22 15:10

ognian