Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Calling networkInfo.isConnected()
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nathan  
View profile  
 More options Jul 23 2012, 4:07 pm
From: Nathan <nathan.d.mel...@gmail.com>
Date: Mon, 23 Jul 2012 13:07:16 -0700 (PDT)
Local: Mon, Jul 23 2012 4:07 pm
Subject: Calling networkInfo.isConnected()

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/ConnectivityManage...>
 and isConnected()<http://developer.android.com/reference/android/net/NetworkInfo.html#i...>
."

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.