how to check in intenet connction is avaliable

by RTX » Mon, 01 Jun 2009 05:19:08 GMT

Sponsored Links
 some times when internet connction is down for conctivity reasons
my app crashes
i want to know how to check intrnet connction before i make a request
ftom the web


how to check in intenet connction is avaliable

by Mark Murphy » Mon, 01 Jun 2009 05:21:54 GMT 

You might try requestRouteToHost() or getActiveNetworkInfo().

Mark Murphy (a Commons Guy)  | 

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


Sponsored Links

how to check in intenet connction is avaliable

by Mark Murphy » Mon, 01 Jun 2009 18:53:34 GMT


The OP needs try/catch, to be certain. I held that truth to be
self-evident. ;-)

However, there is merit in determining at a point in time whether
Internet connectivity exists. For example, you might disable menu
choices that imply the use of a connection.

In this case, I assumed he wanted those connectivity methods as part of
his diagnostics, to confirm his suspicion that the device indeed had no
connectivity at the time of the crashes.

Mark Murphy (a Commons Guy)  | 

Need help for your Android OSS project? 


Other Threads

1. Upgrading from SDK 2.1 rev 1 to SDK 2.1 rev 2

Eclipse complains that it cannot rename the existing 2.1 platform
and that it is locked by Windows and I should stop whatever is locking
I gave it the benefit of the doubt and did close anything and
everything including
the antivirus app. Still nothing. I rebooted in safe mode with
networking and still
this occurs - no one is locking this dir. Is there a bug in the
upgrade of existing
platforms to new versions? Any ideas?

Thanks very much in advance


2. Regarding Device ID

Hello All

It appears to be there is no generic solution to uniquely identify the
device . I am reading lot of discussions here and in stackoverflow.
But I did not come across a standard solution and all are based on
developer's temporary requirements. (IMEI, MEID, ANDROID_ID, Google
account etc nothing are standard).

I have done some tests on HTC, DroidX, Droid2, Nexus phones, which are
either GSM or CDMA with Sim available on them). Surprisingly some
phones returned  NULL when I am trying to read IMEI/MEID using method
android.telephony.TelephonyManager.getDeviceId(). (Note: all the
permissions are given to app to read this info)
Because of this I cannot rely on this method for uniquely identifying
the device.

I thought to rely in using getSimSerialNumber () for uniquely
identifying the SIMs atleast. But even this did not work for me.

Because of this most of the applications which needs some kind of app
security will run into problems.

When I am reading through this discussion

3. (NEED HELP) "Question Mark" di indikator battery Droid 2 dan Droid 2 Global

4. GPS with Map overlay

5. Downloading an .apk update

6. OOT WTI: #droidless

7. Hi..