IntentService has nothing to do with SQLite locking.

Yes, while you are writing to a SQLite database, there is a lock held, so
you will block others trying to read it.

This is isn't an issue because you shouldn't be reading the SQLite database
from the main UI thread -- even if there wasn't the locking, hitting storage
to read data can block for long enough to cause glitches in your app when
animating etc.

Just keep your reads off the main thread, and don't hold the write lock for
a *huge* amount of time.  You should do the updates in smaller batches, so
if your process is killed (for example the user leaves the app and it is
killed for the memory) you still have most of the data you last received.

On Tue, Aug 23, 2011 at 8:06 AM, elin <edwardlinw...@gmail.com> wrote:

> Hi Developers,
>
> I am trying to design a application which can send data and retrieve
> data from the remote web service.
> I am trying to use IntentService periodically to sync data with the
> remote web service. For upload data to server, the IntentService only
> sent a few records. but for download data, sometime the IntentService
> needs to download a few THOUSANDS rows of data from server. While
> downloading the data, I hope the UI thread can still query the local
> Sqlite to display data. But it seems like that Sqlite has the write
> lock while IntentService saving the data to prevent the UI thread to
> read the data from the database.
>
> Any suggestions for this scenario?
>
> Many thanks,
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to