Backing up data

The BlackBerry Device Manager provides a backup and restore tool that a smartphone user can use to save data to a file on a computer and to restore data to the smartphone.

With the Synchronization API, you can create apps that integrate with the BlackBerry Desktop Manager or BlackBerry Enterprise Server to back up data from a smartphone.

The Synchronization API is implemented in the net.rim.device.api.synchronization package.

When an app uses the Synchronization API, the BlackBerry Desktop Manager can back up and restore the app's database at the same time as other databases. You can use the Synchronization API to create data archives or to populate application databases the first time the smartphone connects to the user's computer.

To synchronize data to remote data sources, you must build the synchronization logic into your app. Most apps send data to a server-side application using standard HTTP or TCP/IP protocols over the wireless network and the Internet or an intranet. You can use XML APIs to generate and parse XML-formatted data to send and receive over the wireless network. However, your client-side and server-side applications must read and write the data properly and acknowledge successful transmission of the data.

Your app might connect to an application on a computer to send the data over a USB connection with the Synchronization API and the BlackBerry Desktop Manager. In this case, the desktop application must be able to read the data from your smartphone app through an add-in task for the BlackBerry Desktop Manager. The user must manually execute the synchronization by running the BlackBerry Desktop Manager add-in, which notifies the app on the smartphone to send the data to the computer application. You can also write data to the desktop application using the native USB protocols.

To enable an app to back up data, you can implement the following Synchronization interfaces and use the SyncManager class to register your application for synchronization.

Interface Description

SyncConverter

Converts data between the SyncObject format that is required on the smartphone and the serialized format that is required on the computer.

SyncCollection

Represents the collection of synchronization objects for an app.

SyncObject

Represents an object that can be backed up and restored.

The following sample apps are included with the BlackBerry Java Development Environment: SyncDemo, OTASyncDemo, and OTABackupRestoreDemo.

To back up and restore a small amount of data such as application configuration options, you do not have to implement all of these interfaces. Instead, you can extend the SyncItem class and implement its abstract methods. The SyncItem class implements the SyncCollection, SyncConverter, and SyncObject interfaces for you. For more information, see Backup and restore small amounts of data using SyncItem.


Was this information helpful? Send us your comments.