I just run the below code as a normal java class file and status.isReachable(3000) returns true.
InetAddress status = InetAddress.getByName("android.com");
status.isReachable(3000);
If i run the same code from the Android Project, status.isReachable(3000) always return false. Why is it returning false? Will it always returns false in the Emulator. I had also read this post
[why-inetaddress-getbyname-isreachable-works-on-device-but-not-on-the-eclipse][1]
What I have done so far:
-kept the permission on the mainfest file
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
-disable my firewall.
-ping the android.com from my PC, the host is reachable
I was doing this to check whether the address in the preference is dead or alive
I had a similar kind of problem where my map app background was grey (no tiles) and the browser was unable to connect to the internet.
Within Eclipse I went to Run Configurations -> Target and added “-dns-server X.X.X.X” and everything worked fine afterwards. (obviously X.X.X.X was the IP address for my DNS server).