Skip to content
Arno Welzel edited this page Sep 17, 2023 · 5 revisions

Overview

Periodical allows creating a backup into a custom folder using the Storage Access Framework. This allows to use every file storage which is provided by the device. When creating a backup for the first time, the app will ask the user where to store the backup. At this location a new folder de.arnowelzel.android.periodical is created which is used to store the backup files. This folder can also be transferred to new device to restore the data if you want to use Periodical there.

Before version 1.73

Up to version 1.72 the backup and restore process was quite simple and did just copy the database files (main.db and if neccessary main.db-journal).

However this may cause problems if you want to transfer the files to another (newer) device which expects a journal and the old device did not create one.

A workaround for this is to do a backup on the new device first, so you have a journal file in the backup folder and then copy the data file from the old device.

Since version 1.73

With version 1.73 a new method for backup and restore was introduced: all database tables will now be stored in a single, gzip compressed JSON file where each table is an array element which contains the table name and all records of the table. The file is then also compressing in gzip format.

When restoring a backup in the old format, Periodical will automatically create a backup in the new format and delete the old backup files when successful.

The format is as following:

[
  {
    "version":6
  },
  {
    "data": [
      {
        "eventtype":"1",
        "eventdate":"yyyymmdd",
        "eventcvx":"",
        "eventtemp":"",
        "intensity":"1"
      },
      {
        "eventtype":"1",
        "eventdate":"yyyymmdd",
        "eventcvx":"",
        "eventtemp":"",
        "intensity":"1"
      }
    ]
  },
  {
    "options":[
      {
        "name":"backup_uri",
        "value":"content://com.android.externalstorage.documents/tree/primary%3ABackup"
      }
    ]
  },
  {
    "notes":[
      {
        "eventdate":"yyyymmdd",
        "content":"..."
      },
      {
        "eventdate":"yyyymmdd",
        "content":"..."
      }
    ]
  },
  {
    "symptoms":[
      {
        "eventdate":"yyyymmdd",
        "symptom":"1"
      },
      {
        "eventdate":"yyyymmdd",
        "symptom":"1"
      }
    ]
  }
]

Dates are always stored as 8 digits with year, month and day.

For the event types see app/src/main/java/de/arnowelzel/android/periodical/PeriodicalDatabase.java.

For the possible symptoms see the translations in app/src/main/res/values/strings.xml, the value is also numeric (1-23, but may be extended in future releases).

When restoring a database, the app will first check, if there is an older backup using the database files. If this is the case, the app will try to use the backup as it is and then create a new backup automatically. If this succeeded, the old backup will be deleted to avoid confusion.

Clone this wiki locally