开发者

Android app works on WiFi, in debug mode, or on emulator, not on cell network

I have an android application that parses some HTML, downloads an image, and displays it. I'm using an AsyncTask to do the HTML parsing and image downloading, but that shouldn't be relevant. I never have a problem when I'm on WiFi on my phone, when I'm using the Eclipse debugger on my phone, or when I'm using the emulator. When I have my phone on the cell network (even with pretty good reception), the image sometimes fails to display.

I'm having a hard time figuring out what is wrong, since the problem cannot be reproduced in the debugger. Does anyone have any idea what could be wrong?

Thanks!

Update: I have narrowed it down to the image downloading function. This way my original code:

private Bitmap downloadImage(String url) {
        Bi开发者_StackOverflowtmap image = null;
        debug = "";
        try {
            URL image_url = new URL(url);
            HttpURLConnection image_connection = (HttpURLConnection) image_url
                    .openConnection();
            image_connection.connect();
            InputStream image_stream = image_connection.getInputStream();
            debug = image_stream.available()+"";
            image = BitmapFactory.decodeStream(image_stream);
        } catch (Exception e) {
            Log.e("downloadImage", "Exception: "+e.getMessage());
        }

        return image;
}

I have also tried using the code from this tutorial, but the same bug showed up.

http://www.devx.com/wireless/Article/39810/1954

At this point I think it must have to do with Verizon, but I'm not sure how to figure out what's going on. I wish there was something like Wireshark for Android. I've given my code to a friend of mine on T-Mobile with the G1 and a friend on Sprint with the EVO. I have the Droid Eris on Verizon.


What carrier is that? I remember that T-Mobile always routed http traffic through their own proxy which is a bit slow to refresh, and there were some issues, particularly when the data was under a certain size - 64KB, I believe.

See this thread: http://groups.google.com/group/android-developers/browse_frm/thread/48e84811764da1cb/7f052a903314b2b4?hl=en

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜