I got a AsyncTask that is supposed to check the network access to a host name. But the doInBackground is never timed out. Anyone have a clue?public class HostAvailabilityTask extends AsyncTask<String, Void, Boolean>{
private Main main;
public HostAvailabilityTask(Main main){
this.main = main;
}
protected Boolean doInBackground(String... params) {
Main.Log("doInBackground() isHostAvailable():"+params[0]);
try {
return InetAddress.getByName(params[0]).isReachable(30);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
protected void onPostExecute(Boolean... result) {
Main.Log("onPostExecute()");
if(result[0] == false){
main.setContentView(R.layout.splash);
return;
}
main.continueAfterHostCheck();
}
}
Tracking Valuable Threads from Worldwide Discussion Boards for Android Enthusiasts and Programmers
Android - Check internet access / InetAddress never timeouts
Labels:
Android,
asynchronous,
networking
Popular Posts
-
Trying to found out how to enable "diagnostic" mode on an HTC Android device, specifically a T-Mobile G2 / HTC Desire Z. In my sea...
-
Does anyone know information about how to connect the Samsung Fascinate as Diag Mode driver? ie: this type of connection needed for QPST/QX...
-
Even a basic program that can encrypt and decrypt SD card, at least the external SD card would be acceptable. This way we can be assured tha...
-
On Android phones SMS messages registered to applications also get sent to the device's inbox. However to prevent clutter, it'd be n...
-
Joikuspot is a program for Symbian that bridges the WiFi and 3G connection so the phone acts as a hotspot for wireless connection. I figure ...
-
I decided to wipe all data by turning the phone off and then pressing the home key and the power key. From there it went to the recovery men...
-
I am brand new to cell phones so please excuse the very basic questions and problems I am having. I am trying to get QPST to work with my Sp...
-
Go to: 1. Settings 2. Applications 3. Manage Applications 4. Select Filter 5. Select All 6. Select "Maps" application. It w...
-
What is the best GPS application usable without an Internet connection? (Android) I don't use it by car, just for walking in cities. I...
-
I'm getting this error from time to time and don't know what causing this: When trying to run/debug an Android app on a real devic...