HttpConnection Intermittent Poblems

by Ryan » Fri, 06 Mar 2009 02:22:32 GMT

Sponsored Links

My app uses a simple HttpConnection to download and parse some XML
that I host. The important code is as follows:-

                URL url = new URL(urlStr);
                URLConnection connection = url.openConnection();
                HttpURLConnection httpConnection = (HttpURLConnection)
                int responseCode = httpConnection.getResponseCode();

                if(responseCode == HttpURLConnection.HTTP_OK) {
                        // do useful stuff here
                else {
                                               // display connection
failed error message here

This works all the time on my G1 (based in UK), but a number of my
users are complaing they always see the connection failed message.
This is even though they have 3G connections and can browse the
internet, use google maps etc.

Can you see that I'm doing something obviously wrong?

Is there a more robust way to connect?

Any advice greatly appreciated,



Other Threads

1. App widget configue activity opens main activity.

I hav an app that is like a relational database. There is a main app
activity that users manage things with. There is also a widget that
will display important info and add data to the database. When the
widget is clicked, a configure class displays a way for the user to
edit data. When the configure activity is done, the widget is updated
and instead of going back to the home screen, the apps main activity
is started. I can't find where the main activity is being called from.
Wouldnt I have to create an intent and startActivity() to get this
behavoir? When done updating, I want the home screen and not my app.


2. How to Read/Write .CSV

I'll open with, I googled this thing like crazy, searched anddev and a
few other boards (including this one) and can't quite find what I'm
looking for.

The predicament : all CSV examples are in reference to contacts, and
the file read/write posts (the ones that I need) make the assumption
that I am not a beginner and most don't even post any code leaving me
nothing to learn on.

The hopeful solution : a link to a solid example of simply how to
write to a CSV with my own custom fields and values, and how to read a
CSV and load said values.

I don't imagine anyone is going to take the time to write the code
solely to post it here, so if you can just point me in the right
direction it would be greatly appreciated.


3. Calling .net webservice from app?

4. HELP...about T Mobile G1

5. Windows XP Driver for Nexus One so that Adb can detect the phone

6. Windows Driver for Nexus One so that Adb can detect the phone

7. Windows Driver for Nexus One so that Adb can detect the phone