Tuesday, July 16, 2013

Using your own Pre-populated SQLite database in (Xamarin.)Android applications


Most of Sqlite-net samples – at least the ones I came across – address creating new databases and populating them with data at runtime through calling web services, or else. Nothing on the other side address the situations when you need to start with a pre-populated database.


Thanks to this post, and other questions on StackoverFlow and Xamarin Forums, find below the C# version of the code on the mentioned post. Note that I only “translated” the part that copies the database file from the assets folder to your package data directory. That – off course – requires your SQLite database to be added to you Android project assets folder as an “Android Asset”.


All the opinions expressed on this blog are my own and don't necessarily represent my employer's positions, strategies or opinions.