You didn't say how exactly this fails in your app, but...

- I've seen failures with my app not being able to connect to
(external) servers at all, reported by a few users, even when their
devices had apparently working Internet access. The "magic reinstall"
fixed it for them.

- I've also seen some connectivity types (e.g. accessing a desktop
computer's Internet connection via Bluetooth or USB) not being
properly reported by ConnectivityManager. Had to add code to iterate
over ConnectityManager#getAllNetworkInfo and check if there are any
networks reporting isConnected() || isAvailable().

-- K

2013/7/16 Nathan <[email protected]>:
> 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.
>
>

-- 
-- 
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