> On Sep 12, 2019, at 12:33 PM, mailing lists <mailingli...@skywind.eu> wrote:
> 
> the application also runs on mobile devices and the insertion (excluding 
> indexing) also takes a couple of minutes. This means that the user might 
> switch to another app during insertion and - in the worst case - the system 
> is just terminating my background app. So, all the insertion is lost in case 
> of a single transaction.

[Off-topic]

Your app should not be getting terminated without notice! Use the platform's 
APIs for requesting background time. I'm not an Android programmer, but here's 
what to do on iOS:

When notified the app is being backgrounded, call 
UIApplication.beginBackgroundTask. The OS will give you more time to run. More 
importantly, you'll be notified when the OS wants you to quit, and can clean up 
(i.e. commit the transaction).

To guard against conditions where the OS needs to terminate the app while it's 
in the foreground (low memory or low battery), implement the 
UIApplicationDelegate method applicationWillTerminate and perform the same 
cleanup there.

Note that you won't get notifications like this if your DB processing is 
blocking the main thread's runloop. To prevent that, do the work on a 
background thread, or at least put the runloop in a modal state and 
periodically run it for an iteration.

—Jens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to