I’ve started a series about building Android apps with Xamarin tools. In Part 1, I covered the basics of an Android app – how to add buttons to the page, give those buttons text, how to build a new screen and navigate to it. Today, I’d like to talk about data storage.
Almost all apps need some type of data storage. As usual, there are multiple approaches you can take.
If your data storage requirements are very straight forward, then you might just want to consider storing your data in XML files. Especially if the amount of data will be small and simply to query. Storing your data as XML would also help make it easy to export it since the data are in simple flat files.
As simple as the XML approach is, SQLite is not much more complex. But SQLite brings some benefits, especially in the long run. If you’re not familiar with SQLite, it’s worth checking out. It is beneficial even outside of the mobile world. From the SQLite website:
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
The SQLite database a single file and so can be stored in any file system. It can be used on just about any system out there. No, you can use it to replace Oracle, SQL Server or MySQL, but it works create for local storage.
A benefit of going the SQLite route is that you can use an ORM.
Azure is an interesting choice, in my opinion. Azure offers support for both Android and iOS so if you were going to deploy an app on both platforms, you could use Azure as a single back-end to both apps.
For data storage Azure offers MS SQL Server, blob storage and MongoDB. So if XML was a basic option and SQLite a middle option, I think Azure would be a good option – if you need the flexibility and cross-platform support.
These are the three data storage options that I’m familiar with. Are there other options out there that I should be aware of or consider? Let me know in the comments or give me a shout!