On Tuesday, July 16, 2013 10:37:16 AM UTC-7, Robert Greenwalt wrote:
>
> You certainly can have a race condition, but the more likely thing is 
> either the network never had internet reach (walled garden) or temporarily 
> doesn't have access to the internet.  Both the cell radio and wifi have a 
> tendency to hold on trying to get reconnected before they give up and 
> report a disconnection.
>
>  

> Other than that, your code looks good.
>
> You can also cache this value and then listen for broadcasts rather than 
> calling ConnectivityManager all the time - depends on how often you check 
> this.
>
 
Based on a previous question I posted here, I heard that the call was not 
expensive, so I haven't bothered to cache for very long. But the broadcasts 
may be helpful in another context. 

Nathan

 

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to