Backing Up Your Room

Users do not like it when their data vanishes, gets damaged, or otherwise becomes unusable.

Fortunately, modern smartphone hardware is fairly reliable. Still, problems can happen. Sometimes those problems come from the user, such as accidentally deleting something that they would rather not have deleted.

While the OS offers “backups”, in reality Android’s “backup” mechanism is embarrassing:

In short, Android’s “backup” mechanism is for disaster recovery (e.g., user dropped their phone in a toilet and replaced the phone). You may want to offer something else that is more user-controlled. This chapter will explore how to do that.

Backup and Restore. Or, Import and Export.

“Backup” and “restore” imply making a copy of the data, such that in case of a problem with the original data, we can replace the damaged original with the copy.

“Import” and “export” imply making a copy of the data, such that the user can perhaps manipulate that data in some third-party tool. Later, the “import” implies that we can take external data and add it to the app’s own data, or perhaps replace the app’s own data outright.

The line dividing “backup/restore” and “import/export” is rather blurry. If you back up data to a user-accessible spot, and the data is in an open format, “backup” and “export” become identical, in effect. You may not intend for the user to use the data in another piece of software, but you cannot stop it either.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.