My application collects information entered by the user and stores it
in a sqlite database. The information is observed and entered every
few minutes. Each observation, or entry, becomes a record in a
database table. Each record needs to be transmitted via httpClient to
a server as soon as possible. The user, phone, may have intermittent
service. Each record is stored in the database immediately with a
isSent flag set to false. Next, I use AsyncTask to start a thread
separate from the UI thread, and attempt to transmit all the records,
one at a time, where isSent is false. If a record is successfully
transmitted, isSent is set to true. If httpClient gets a timeout or
page not found, I interperet that as no service and break out of the
process. I have all this written and successfully beta tested. (with
much help from this group. THANK YOU Android Developers Group.)

I used a Service in my first attempt at the routine to transmitt the
records. The documentation of Service indicated something about long
processes working w/o user input. But I found when there was no
internet connection, the routine took too long and I got a
"application not responding" error because the wait was in the UI
thread. I reprogrammed it utilizing AsyncTask to start a seperate
thread for the transmitt process and this seems to work w/o error.
During my reprogramming, I was confused on how to utilize both a
service and a AsyncTask, so I just did it without utilizing a Service.

Was my decision to drop the Service a good choice? Or am I missing
something useful offered by Service that would benifit this situation?

Thanks, John Brown

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to