On Wed, Oct 24, 2012 at 11:45 AM, Mark Murphy <[email protected]> wrote: > On Wed, Oct 24, 2012 at 2:36 PM, Subodh Nijsure > <[email protected]> wrote: >> We don't want this upload process to happen in context of UI hence >> the service. > > Please use a single process, and simply have the upload work be done > in a background thread.
I guess then I am confused on if "sync" thread terminates if the UI activity is destroyed or not. What I want to happen is this background thread that syncs data to aws should never terminate,and ideally it should get started when device boot finishes i.e. data collected while there was no network connectivity, should get uploaded to AWS without user having to do it explicitly. I do start my service such that it returns START_STICKY in its onStartCommand(), is that sufficient for the service to keep running even if activity is destroyed? > >> I read the commons ware book (page 459 to be specific) and the >> database instance that content provider uses singleton database object >> based off of getActivity().getApplicationContext(). > > Page 459 does not say this. > > It says that you need to use a single SQLiteDatabase object if you > want SQLiteDatabase to help with thread safety. Page 459 does not > address ContentProvider at all. > Yes it does not mention CP, didn't mean to imply it did. >> Now the question is -- what happens if the service (3) is using the >> content provider and user starts the UI (1) that also attempts to use >> the same content provider, is the UI going to experience issue opening >> the database, is it going to encounter ANR? > > Possibly. SQLite implements process-level locking -- you use it all > the time from, say, Ruby. I have not played with its effects on > Android, as I don't waste the user's RAM and CPU with extra processes. > >> Put other way, does the content provider run in its own process? > > It runs in the process that the rest of your components run in, normally. > >> And >> are requests & responses to content provider serialized? > > I do not think so, but I have been confused on this particular point before. > > -- I am going to try and model this (best I can) but I just wanted to get expert opinion to see if its worthwhile -Subodh -- 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

