Chapter 3. Managing App Data

In this chapter, we will cover the following recipes:

  • Storing data with SharedPreferences
  • Using files and the filesystem
  • Reading bundled assets and resources
  • Parsing, processing, and generating XML
  • Accessing data with ADO.NET
  • Accessing data with SQLite.NET
  • Encrypting databases with SQLCipher
  • Consuming content providers
  • Creating content providers
  • Backing up preferences and files to the cloud
  • Backing up data to the cloud

Introduction

Data is possibly the single most valuable entity in the world, whether it is personal data about a user or person, or it is general data about the world. Companies spend billions collecting this data, and it is sought after by other companies.

What makes data so valuable? Data is correct and accurate, and it can be used to make decisions, which are both helpful as well as potentially lucrative. Data is valuable because of what can be done with it.

Companies spend billions collecting data and then spend billions more protecting it. Data can lose some of its value when it becomes public knowledge; not that the data becomes less valuable but rather the value from the decisions made. If the data becomes public, then other companies can use it to get a competitive advantage.

In addition to losing competitive advantage, personal data can be used to compromise personal security and privacy. The data can be used to impersonate a user, and possibly, do harm.

Regardless of where the data came from or what it is used for, data needs to be stored and processed. Data only attains its true value if it can be queried and then processed into information.

Data can be stored in key-value pairs, structured files, and relational databases. There are many other ways to store data, but the storage mechanism is chosen to best suit the querying or processing requirements.

Mobile apps are no different; over time, they can collect data about users and their preferences. This data is then stored locally or on the cloud. This data is backed up and encrypted for security purposes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset