Most of the commercial mobile application uses local storage for large data processing and to improve efficiency. While mobile applications are limited with memory and processing, the way you store, manage and process on data it is always been very tricky. Think a bit, before jumping straight into designing a database for your application.

Both Android and iOS platform provides different mechanism to deal with data storage. You must understand each of the option to choose one over other. Following are some of the available data storage mechanisms for mobile mobile platforms like Android and iOS.

1. Key Value Preferences

Preferences are most used way to store simple data of key value pair. They are local to your application, you will loose the data once the application is deleted from device. This option of data storage is preferred for storing application rationalization information. In Android it is named as shared preferences and in iOS it is called NSUserDefaults. Additionally iOS users can take advantage of iCloud technology for data backup and synchronization in multiple devices.

Here is the link to Shared preference in Xamarin.Android example , that might intrest you.

2. Text Files / Serialized Data Files

Text file is most easiest and convenient way to sore data such content downloaded from server. You may use different data encryption mechanism for ensuring the data security.

Objects can be serialized and persisted as XML or JSON on the file-system. The .NET framework includes libraries that make serializing and de-serializing objects easy. Use appropriate names to organize data files.

3. Database

SQLite is an Open-Source embedded SQL database engine built available on both iOS and Android platforms. SQLite provides relational database management structure for storing user defined records in the form of tables. SQLite is light weight when it comes to resource usage and it doesn’t need to have any server setup like other RDBMS systems. It is an cross platform and self-contained database. Database storage is suited to lists of data with many properties.

Following are some of the advantages of using SQL database engine

  1. SQL databases structured and efficient for storing data
  2. Allows simple and complex queries, that helps to extract specific data
  3. Query results can be sorted
  4. Query results can be aggregated
  5. Similar to other RDBMS, which helps developers to utilize existing knowledge in database design
  6. Allow application to pre-package with database

You may take advantage of the ready to use ORM (Object Relational Mapping) such as SQLite.NET components from Xamarin Component store for quick integration for SQLite storage. Here is the link to SQLite.NET components integration example, that might intrest you.

4. Image files

As mobile devices are limited with memory, it is highly recommended not to use database for storing large size images. Images must be stored into device file-system and only the mapping file name can be stored into database. If you’re dealing with many images in your application, it is a good practice to have image caching logic in place.

Nilanchala

A blogger, a bit of tech freak and a software developer. He is a thought leader in the fusion of design and mobile technologies. He is the author of Xamarin Mobile Application Development for Android Book (goo.gl/qUZ0XV3), DZone MVB and founder of stacktips.com.

Join The Discussion

Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.