Thank you, that is probably the info I needed. Nathan
On Monday, July 23, 2012 1:41:08 PM UTC-7, Robert Greenwalt wrote: > > This is checking static data in the ConnectivityService. It doesn't leave > the device, but it will leave your process. These calls don't do any > network activity and could be done on your UI thread. > > Note that this check is not a promise that your request will complete - we > can lose contact at any time. Given that, it's probably worth calling once > before you start a complex/expensive sequence, but not really worth calling > throughout. > > Calling isConnected does not warm up the radio - only network traffic will > do that. > > R > > > On Mon, Jul 23, 2012 at 1:07 PM, Nathan wrote: > >> I wanted to ask a practical question about checking for network >> connection, which is probably a simple question. I am sure this is an easy >> question. >> >> I'm looking at this: >> >> http://developer.android.com/training/basics/network-ops/connecting.html >> >> "Before your app attempts to connect to the network, it should check to >> see whether a network connection is available using >> getActiveNetworkInfo()<http://developer.android.com/reference/android/net/ConnectivityManager.html#getActiveNetworkInfo%28%29> >> and >> isConnected()<http://developer.android.com/reference/android/net/NetworkInfo.html#isConnected%28%29> >> ." >> >> This is in context of doing 10s of networks calls on multiple threads to >> retrieve small files (about 20K) over http. >> >> In practice, is there any cost for making this call? Does it initiate a >> network operation or stay on the device? What percentage of the time is it >> actually wrong? Would it be actually faster to see if one of my http >> operations gets a sockettimeoutexception or a connectiontimeoutexception? >> >> Based on that webpage, it calls isConnected() on a UI thread, just before >> explaining that "network operations can involve unpredictable delays" and >> should be done. Does that mean that isConnected() is a short and >> predictable delay, or should I not read that much into it? >> >> In one of the battery life classes at I/O, they talked about how the 3G >> radio takes a bit to warm up, and that you might as well do a bunch of >> network traffic while it is warm (paraphrasing a bit). Does simply calling >> isConnected() warm up that radio? >> >> Nathan >> >> -- >> <http://groups.google.com/group/android-developers?hl=en> > > > -- 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

