Fetching messages from a server

by Kevin Anthony » Sun, 27 Mar 2011 00:25:00 GMT

Sponsored Links
 I have an application that needs to fetch messages from a server,
currently i do this via a service, running in the background.
However, when my application is not in the foreground, it quickly gets
pushed out of memory, and stops checking for messages.

I've been playing with AbstractThreadedSyncAdapter, but this seems a
little heavy handed.

Is there some middle ground?  Something i should look into?

Kevin Anthony


Re: Fetching messages from a server

by Mark Murphy » Sun, 27 Mar 2011 00:32:53 GMT

 On Sat, Mar 26, 2011 at 12:24 PM, Kevin Anthony

This is a good thing. An everlasting service like this is an
anti-pattern and should be avoided wherever possible.

little heavy handed.

Could be -- I haven't had a chance to mess with that yet.

Use AlarmManager and fetch the messages on a periodic basis, with the
user controlling the polling frequency (including an option for
manual-refresh-only) via a SharedPreference.

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

Android Training in London:  http://bit.ly/smand1 ,  http://bit.ly/smand2 


Sponsored Links

Re: Fetching messages from a server

by Kevin Anthony » Mon, 28 Mar 2011 06:40:50 GMT

 Thanks, that did the trick

Kevin Anthony


Other Threads

1. To Play .mp3 from host machine filesystem

Hi All,

Is there any procedure to play .mp3 file stored in a filesystem of
host machine (windows XP) without getting into file system of

I know its least useful scenario but i am just curious to know
whaether MediaPlayer class supports it or not ?


2. About davikvm's GC


I have some small questions about Davikvm's GC:

Does davikvm's gc derived from Apache harmony GC?
If it is true, which version of GC it is based(I mean GCv5 or ...)?
Are there some big upgrade or update related which davikvm's GC later?



3. How to find out which package started an intent?

4. service with a UI

5. Unable to get all phone numbers of a contact.

6. Why Google does not accepts my Visa credit card?

7. FM application on Android.