Archived:Enabling backup and restore for installed C++ applications
In S60 3rd Edition, installed applications will not be backed up by default. 3rd party application developers need to enable backup and restore for their applications by including a backup_registration.xml file in the application's private directory.
A backup registration file typically includes the following information:
- For passive data backup operations, a list of private directories and files that should be backed up. It is possible to list a directory for backup and then list subdirectories or files that should be excluded. These directories and files are defined relative to the process private area, so it is not possible to refer to private files owned by another process (a single backslash denotes the whole private directory). If some files or directories do not exist, no error will be raised; that is, it is acceptable to list directories which do not exist yet. If an incremental backup is inefficient for the data, it is possible to specify that only base backups should be done. For example, if the data owner stores all data in one database file, an increment will always be the whole database file. In this case it is more efficient to always do a base backup or the restore involves transferring large amounts of redundant data.
- A list of public files and directories to be backed up as part of a partial backup. The same syntax is used as for private files but with regard to the public part of the filing system. Any system or private files are ignored from this section (because they are not public files). As with files listed for passive backup, the list can include directories that do not yet exist.
The following is an example of a backup registration file for a data owner that requires passive backup of all its files and system files ( \private\<UID>\):
<?xml version="1.0" standalone="yes"?> <backup_registration> <passive_backup> <include_directory name = "\" /> </passive_backup> <system_backup/> <restore requires_reboot = "no"/> </backup_registration>
The above code can be used as a default template for applications that store files only under the \private directory structure.
If an application wants to store data which is accessed by another application, the data should be stored in the C:\Data directory. This directory will be automatically backed up and doesn't need to be defined in the backup registration file. However, if the application wants to backup other public directories, they should be defined using the <public_backup> tag.
For example, the following registration file defines two additional public directories that need to be backed up:
<?xml version="1.0" standalone="yes" ?> <backup_registration> <passive_backup> <include_directory name="\" /> </passive_backup> <public_backup> <include_directory name="c:\cities\" /> <include_directory name="e:\cities\" /> </public_backup> <system_backup /> <restore requires_reboot="no" /> </backup_registration>
If the application requires more control over the files that are backed up and restored, it can register for active backup. The secure backup engine will start any process registered for active backup, if it's not already running. It is the application's responsibility to react to backup and restore events, and actively provide its private data to or receive it from the secure backup engine.
For more information, see: