Friday, April 29, 2011

[android-developers] URLConnection & Verizon 3G

Gentlemen:
In my app, I have a need to copy a small file (1.5Mbyte) from a
central file server. I implemented the functionality using
URLConnection. Following is an excerpt from the code:

***********************************************
url = new URL(serverURL + "catalog.txt");
URLConnection urlConnection =
(URLConnection)url.openConnection();
urlConnection.setConnectTimeout(10000);
urlConnection.setDoInput(true);
urlConnection.setReadTimeout(30000);
//urlConnection.connect();

InputStream inStream = new
BufferedInputStream(urlConnection.getInputStream());
**************************************************

First I discovered that this does not work in the emulator and that is
fine. I accept that.
On an actual test device (Motorola Droid), it works perfectly fine but
only when the device is connected via WiFi.
It just does not work over the Verizon 3G Network. Yes, when the WiFi
is disabled or I am away from the WiFi access point I can indeeed
browse the web etc. However my routine does not work over the Verizon
3G Network. It always throws the following error:

java.io.IOException: Unable to connect to server: Unable to retrieve
file: 425

Any ideas? If this method of downloading a file just does not work
over the 3G network, then could anyone suggest another way to
implement this functionality?

Any suggestion will be greatly appreciated.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment