A very fast check is whether you have a valid IP address assigned.

Another more complicated way is to use the network manager and listen
for connection state changes. In case of you get disconnected you
could keep this information in a persistent storage. Check this
persistent information before you do any data connectivity. When the
network manager receives a connection state change event for
"connection established" change the persistent information to
"connection established".

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Aug 20, 3:24 pm, cafffiene <[email protected]> wrote:
> What is the simplest way to check whether my app can access the
> internet?  I am using some APIs that use the internet, but they crash
> if there is no connectivity.  So I just want to check if there is
> internet access by any means.  thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to