I need to use JDBC and H2 (instead of sqlite) for an Android app. The app will be composed of multiple Activities and will target modern android tablets (Android 3+).
The activities lifecycle on Android is tricky, and what i want to avoid is H2 being killed by the OS and risking a corrupt database. What is the best approach to be safe? Should I always open the database in the onResume() callback of an Activy and close it in the onPause() callback? It would have to be done asynchronously from the main thread, and syncrhonized so another activity from the same app doesn't try to open H2 while it's being closed. I think it would be safe, but i am afraid of performance issues when navigating from one activity to another (opening h2 can take 500ms to 1s on my tegra 2 tablet) Or should I manage H2 from an android Service that all my activities would bind to? The service would be stopped by android when no activities are bound to it. I am new to android and maybe i am overcomplicating things... I would appreciate advices from other developpers who have used h2 on android. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/kOCFwG43R-QJ. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.