detect if there is a connection to internet

by Marton Kodok » Sun, 15 Nov 2009 17:33:22 GMT


Sponsored Links
 Hello,

I want to detect if there is a connection to Internet before launching a
webview.
How can I detect it?

-- 
Mrton

--



detect if there is a connection to internet

by Smelly Eddie » Mon, 16 Nov 2009 01:14:14 GMT


 You can use ConnectivityManager and check the returned networkinfo
object.

 http://developer.android.com/reference/android/net/NetworkInfo.html 




--


Sponsored Links


detect if there is a connection to internet

by Indicator Veritatis » Mon, 16 Nov 2009 06:55:59 GMT


 Now maybe Marton will figure it out, he was, after all, the person who
asked the question. But I cannot figure out how to tell whether the
phone is connected to the Internet from NetworkInfo, not even from the
more detailed version, 'NetworkInfo.DetailedState'

Rather, the questions this object answers are just a little different:
on the Wifi net, it tells you when you have a 802.11 connection, on
the phone network, it tells you when the phone network is idle/
connected/disconnected. But I see no way to differentiate between, say
for example, 802.11 MAC level connectivity and 'Internet', which has
to mean at least IP if not TCP level connectivity. After all: the text
does say, "Describes the status of a network interface of a given type
(currently either Mobile or Wifi)". Both of these interfaces can
return CONNECTED without any connection to the Internet being
available. Hopefully, that is not too common in the Mobile case, but
it certainly is common in the WiFi case: it is distressingly frequent
that you have connectivity to the local net, or even to the local
access point -- and no further.

Now maybe this is good enough for Marton. But the question he
originally asked was about "Internet connectivity", which really is
different.





--



detect if there is a connection to internet

by Mark Murphy » Mon, 16 Nov 2009 12:48:52 GMT


 


 http://www.androidsnippets.org/snippets/131/ 

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, $35/Year

--



detect if there is a connection to internet

by Jabbslad » Mon, 16 Nov 2009 12:48:58 GMT


Other Threads

1. How to manage 2 versions of the same app: a lite version and a full version?

If someone wants to add an option to aapt to rewrite the .apk to have a
different package name than the one in the manifest, I'd love to review it.
This is a little tricky -- you need to rewrite the manifest's components and
such to also work with the new package -- but should be quite doable.

And the nice thing for this kind of stuff is that you don't need to wait for
it to ship on a device to use it. ;)








-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~

2. How to manage 2 versions of the same app: a lite version and a full version?

http://dev.bostone.us/2009/05/02/android-how-to-deploy-multiple-versions-of-the-same-app/

this may help you.



--~--~---------~--~----~------------~-------~--~----~

3. Is it possible to upgrade HTC Magic G2 from 1.5-Cupcake to 1.6-Donut ?

4. Mediastore Thumbnails not generated until Gallery app is launched ?

5. Golf App for Android

6. documentation issue

7. download layoutlib.jar