Check if device is online or offline

by Simon » Fri, 22 Apr 2011 03:39:26 GMT

Sponsored Links

I have hunted around, but can't seem to find an answer to this.  I am
working on an app that will be using local storage through the SQLite
DB, but will also be syncing to a remote server.  If the device is
online, I would like to be able to sync to the remote server, and if
it is offline, I would like to store an event that indicates there is
data to send once the device is online again.  But I can't seem to
find in the API how to query for the current online/offline status of
the device.  Is there something like this available?




Re: Check if device is online or offline

by Mark Murphy » Fri, 22 Apr 2011 04:00:51 GMT

 See ConnectivityManager and getActiveNetworkInfo().

Mark Murphy (a Commons Guy)  |  | 

Android 3.0 Programming Books: 


Sponsored Links

Other Threads

1. Moving to the next ImageView in HorizontalScrollview?


I have a horizontal scroll view and there are four images in it. Now
what I want is the way to detect which image is focused currently. I
mean, is there any way that we can distinguish between the image that
is focused and other images. Currently all the images look quite

One more thing, how to move only to the next image on every swipe or

Moreover, I have tried the same thing with Gallery, but I didn't found
anything in the Gallery that let me move to the next view only. In
Gallery, I have tried overriding the onfling method with hardcoded
value for veloctiyX but with no success. Can someone let me know how
to do this?

Doing the same thing with either Gallery view or HorizontalScrollview
will solve my issue.

Hope to get the quick response.



2. Force Close when running AccountManager.get(this).getAccounts()

Hi all,

    I tried to retrieve user's gmail address on Android phone using
AccountManager.get(this).getAccounts(), but got force close when
running the code in emulator (platform 2.2, API level 8) and Motorola
Droid handset...
    Do I need any user-permission in manifest file? what else I might
be missing?

Thanks much!


3. Retrieving Contact Information (Name, Number, and Email) from the Phone book

4. Creating an Android VN

5. my own app store ?

6. Relation data in Contacts app

7. How to kill application