Application HANGS UP if 3G connection is used (WiFi is OK)
- by SkyEagle888
Hi,
My application uses the following codes to connect to web site and download a web page for processing.
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.setRequestProperty("User-Agent", "Mozilla/3.0 (compatible; MSIE 4.0; Windows NT)");
c.setRequestProperty("Accept-Language", "zh-hk");
c.setRequestProperty("Connection", "Keep-Alive");
c.setConnectTimeout(6000); // mTimeout is in seconds
intTries = 3;
do {
c.connect();
if (c.getResponseCode() == 200) {
break;
}
else {
intTries --;
}
} while (intTries > 0);
The codes are run in main thread only. If WiFi is being used, it is nice and clean. If 3G connection is being used, sometimes, it cannot get connected OR application HANGS.
Is there any significant difference between handling WiFi and 3G ?
Thanks.