The following is what I have seen as a fairly standard method for checking 
for an internet connection. 

   @Override
    public void checkforConnection(Context ctx) {
        // TODO Auto-generated method stub
        ConnectivityManager mgr = (ConnectivityManager) 
ctx.getSystemService(Context.CONNECTIVITY_SERVICE); 
        NetworkInfo ni = mgr.getActiveNetworkInfo();
        if(ni==null)
            this.noConnection.set(true);
        else if(!ni.isConnected())
            this.noConnection.set(true);
        else
            this.noConnection.set(false);
        
    }

Is there any way this can fail?

I have been using this for six months. Only two identifiable complaints. 
They may not be sophisticated enough to know if they have an internet 
connection, though. One has a friend that installs apps for him. 

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