Check if device is online or offline

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


Sponsored Links
 Hi,

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?

Thanks,

Simon

-- 



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)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android 3.0 Programming Books:  http://commonsware.com/books 

-- 


Sponsored Links


Other Threads

1. Moving to the next ImageView in HorizontalScrollview?

Hi,

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

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

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.


Regards
Sunil

-- 

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

-- 

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