Using an AsyncTask is fine. But to keep the IOCipher side simple, you'll want some kind of queue to make sure there is only one write happening at a time. You can use an IntentService instead of an AsyncTask since that gives you the threading and the queue.
There is also a way to make sure that threads finish with IOCipher, so it can be unmounted, but I can't remember off the top of my head the details there. .hc Robert Wiley: > Thats excellent thanks. > > Maybe my problem is that I'm using an async task to handle the writing? > > The reason being that I want to be able to update the user with the > progress of the write and not have the UI freeze up while the write is > occurring. Is there another way I should be doing it? > > I have noticed that when I try to unmount after a write has occurred I > always get an exception about threads still in use, though I am only > allowing a single write at a time and I don't allow reading while the write > is happening... > > Rob. > > > Robert Wiley: >> Hi, >> >> I've been playing around with IOCipher for a while and it's really great! > > Thanks, we're glad its useful! > >> Couple of questions if anyone has the time. >> >> Is there anyway to manually ask the database to perform a checkpoint and >> write the contents of the write ahead log to the database? > > It should do that automatically, unless your app is under extreme, > parallel, concurrent write load. That's what our tests have > consistently shown us, at least. > > >> I've noticed that the WAL file seems to grow continually and can get quite >> large and only seems to get written back to the database if the app >> (Android) is fully closed (force closed by the user or the OS kills it). > > The WAL log only grows by design, to make it more efficient. That does > not mean that it is all being used at any given time. Once stuff in the > WAL is written to the database, that area in WAL is marked as free and > will be reused in the future. If I remember correctly, doing a SQLite > vacuum will shrink the WAL down to what is currently being used. > > >> Also when should I be using be using beingTransaction and >> completeTransaction? are these only for writing files to the container > (ie. >> call startTransaction, write file contents, call completeTransaction)? > > Unless you are doing something really complicated, you should need to > even think about this stuff. If you keep all of your writes in a single > thread, that'll reduce complexity and keep it running efficiently. > Multiple threads reading is fine. > > .hc > > -- > PGP fingerprint: EE66 20C7 136B 0D2C 456C 0A4D E9E2 8DEA 00AA 5556 > https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE9E28DEA00AA5556 > _______________________________________________ > List info: https://lists.mayfirst.org/mailman/listinfo/guardian-dev > To unsubscribe, email: [email protected] > -- PGP fingerprint: EE66 20C7 136B 0D2C 456C 0A4D E9E2 8DEA 00AA 5556 https://pgp.mit.edu/pks/lookup?op=vindex&search=0xE9E28DEA00AA5556 _______________________________________________ List info: https://lists.mayfirst.org/mailman/listinfo/guardian-dev To unsubscribe, email: [email protected]
