I was wondering if there were any suggestions (idioms or patterns) ensuring (to the best extent) how a background Service should manage a database in order to minimize or eliminate the potential for data corruption potentially stemming from a missed SQLiteDatabase.close(). The service runs independently from any Activity, and needs to write data frequently to the database since it is used for data acquisition.
Service.onDestroy() would seem to be the best candidate, but onDestroy() is not guaranteed to be called if the kernel needs to kill a process hosting the Service. The only apparent solution is to set the Service to foreground, essentially making it un-killable. But I'm not sure if this is the best approach. Thanks -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

