Hi I have the same problem. I noticed that i have this problem when i'm debugging and that the device is connected via USB . when i disconnect the cable , i still have this behaviour until i stop and start the wifi. after restarting the wifi , connections are fine.
Chris On 25 nov 2008, 16:49, "Tom Gibara" <[email protected]> wrote: > Yes, it's on the UI thread. > I still think the balance of probabilities is a bug in your code. As far as > I know, permissions are assigned on a app-process basis. And what's the > likelihood of some unspecified change causing the problems, versus a race > condition in your code triggered by a difference in speed between the > emulator and the phone? > > Produce a tidy test case and report an issue, then everyone can find out > it's a bug in the Android framework. Until then I think we have to assume > its your bug. > > Tom. > > 2008/11/25 joshv <[email protected]> > > > > > Tom, see upstream - it works fine for me now when I launch the polling > > thread from the UI thread. I was launching it from the constructor of > > another class, and for some reason this causes issues. It's quite > > reproducible. If I launch the polling thread from the UI thread it > > works. If I go back to launching it in the constructor it goes back > > to being very unreliable. > > > I assume your example below is being called directly in the UI thread > > as you are updating UI objects directly. > > > On Nov 25, 9:15 am, "Tom Gibara" <[email protected]> wrote: > > > I just spent a minute knocking out a test case over a cup of tea. Seems > > to > > > work fine for me on WIFI, GPRS, and 3G. > > > Tom. > > > > void testConnection() { > > > TextView view = (TextView) findViewById(R.id.message); > > > HttpURLConnection conn = null; > > > try { > > > URL url = new URL(" > >http://finance.yahoo.com/d/quotes.csv?s=GOOG+T&f=sl1c1p2"); > > > conn = (HttpURLConnection) url.openConnection(); > > > conn.setRequestMethod("GET"); > > > conn.connect(); > > > Reader reader = new InputStreamReader( conn.getInputStream() ); > > > StringWriter writer = new StringWriter(); > > > for (int c = reader.read(); c >= 0; c = reader.read()) > > > writer.write(c); > > > view.setText(writer.toString()); > > > } catch (IOException e) { > > > Log.e("test", "connection test failed", e); > > > } finally { > > > if (conn != null) conn.disconnect(); > > > } > > > > } > > > > 2008/11/25 joshv <[email protected]> > > > > > I can disclose the URL, it's publicly available and always up - yahoo > > > > finance csv stock price download. For example: > > > >http://finance.yahoo.com/d/quotes.csv?s=GOOG+T&f=sl1c1p2 > > > > > It doesn't get much more highly available than this. I could test > > > > other URLs, but as I have mentionned before, the exact same code, with > > > > the exact same URL runs marvelously in the emulator, so I very much > > > > doubt it has anything to do with the URL. It's also not specific to > > > > wi-fi on the handset. I get the same behavior when I disable wi-fi > > > > and use only 3G. > > > > > It would take me a bit of work to create a reproducible snippet, no > > > > proprietary concerns - just space. The code snippet I've already > > > > posted is simply running in another thread spawned by the UI thread. > > > > If I get some time I will try to work on a self-contained demo that > > > > reproduces the problem on my handset. > > > > > On Nov 25, 7:02 am, Mark Murphy <[email protected]> wrote: > > > > > joshvwrote: > > > > > > I am really starting to think that there is something wrong with my > > > > > > handset. I certainly have no problem with transient disconnects > > and > > > > > > such resulting from moving from cell to cell, or from 3G to wifi, > > or > > > > > > edge to 3G - but I am sitting 3 feet from a very stable access > > point. > > > > > > Here's my recommendation on how to proceed: > > > > > > First, create a separate really simple application that uses your > > > > > current techniques (URLConnection or HTTPComponents) to access a Web > > > > > site. Retrieve a Web page that is a no-brainer > > > > > always-gonna-work-for-everyone page, particularly one that is OK for > > you > > > > > to disclose. > > > > > > If this gives you the same symptoms as you're experiencing in your > > main > > > > > application, post the manifest, layout, and activity source code, so > > > > > some of us can try it and see if we get problems on our devices. > > > > > > If, however, this simplified example works just fine, start to slowly > > > > > convert it to look more like what's giving you problems (e.g., switch > > to > > > > > the actual Web page you're trying to hit instead), and see where the > > > > > problems creep in. > > > > > > At the point when you start getting problems again, if your test code > > is > > > > > still safe for public release (e.g., no proprietary information), > > post > > > > > the manifest, layout, and activity source code, so some of us can try > > it > > > > > out and see if we get the same problems. > > > > > > Going all the way back to your original post, the snippet of source > > you > > > > > provided doesn't seem problematic (other than I'm a fan of > > > > > HTTPComponents over URLConnection), but, then again, we aren't going > > to > > > > > be able to reproduce your problem with just that snippet. > > > > > > In the end, if we collectively get a reproducible scenario that > > works, > > > > > that sample code should serve us well on the issue tracker to make > > sure > > > > > this gets looked at. > > > > > > -- > > > > > Mark Murphy (a Commons Guy)http://commonsware.com > > > > > > Android Training on the Ranch! -- Mar 16-20, 2009 > > > >http://www.bignerdranch.com/schedule.shtml --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

