This article applies to BlackBerry® smartphones based on Java® technology
There are three ways to store application data on BlackBerry smartphones:
Note: For detailed instructions on how to use the two storage models, please see the “Storing persistent data” section in the BlackBerry Java Development Environment Version 4.0: BlackBerry Application Developer Guide. This guide covers all programmatic saving, retrieving, and deletion of persistent data. However, it does not discuss what happens to persistent data upon removal of an application.
An application can be removed by using either the Application Loader in BlackBerry® Desktop Manager or by accessing the list of Applications on the BlackBerry smartphone.
If you use BlackBerry® Device Software 4.0 perform the following:
- On the Home screen, click Options > Applications.
- Select the application to delete, click the trackwheel, and select Delete.
If you use BlackBerry Device Software 4.1 or later:
- On the Home screen, click Options > Advanced Options > Applications.
- Select the application to delete, click the trackwheel or trackball, and select Delete.
MIDP record stores
If you store the application data using MIDP record stores on BlackBerry smartphones with BlackBerry Device Software earlier than version 4.1, the application data is not deleted when the application is removed. If removing this data is absolutely crucial, complete the following:
Note: The following will impact more than just the desired application - it will wipe all Record Management System (RMS) databases on the BlackBerry smartphone.
- Connect the BlackBerry smartphone to BlackBerry Desktop Manager.
- In BlackBerry Desktop Manager, open Backup and Restore and click Advanced.
- Click RMS database > Clear.
If the BlackBerry smartphone is using BlackBerry Device Software 4.1, the application data is always deleted once the application is removed.
Since MIDP record stores can only be accessed by the application that owns them (there is no data sharing), you do not need to keep the data once the application is removed. The only exception to this rule is if the application is being replaced as part of an upgrade using the Application Loader tool, a wireless download, or the application is pushed out from the BlackBerry® Enterprise Server.
Note: When upgrading, all data remains.
The BlackBerry persistence model
When you use the BlackBerry persistence model, data is only deleted if the store contains classes that belong to the removed application.
For example, if an application stores an object with a class called com.mycompany.application.storage.MyDataand no other application on the BlackBerry smartphone makes reference to this class, the persistent store and the removed application are deleted.
The same is true if the object is wrapped in a container such as a Vector. Even if only one of the elements of the Vector has a package name that is not used by other applications, the entire Vector is removed from the persistent store.
If you store a built in class, such as String in persistent store then the data is not removed when the application is uninstalled.
Note: If the application does not store any objects with an identifying package structure, (for example, an application that stores
javax.microedition.location.AddressInfo objects), the application should create and use a class that extends
Vector in order to identify that
Vector belongs to the given application. When you store this
Vector, which is identified uniquely by its package, you guarantee that the data is removed from the persistent store when the application is removed.
The BlackBerry file store (FileConnection)
Data stored by applications using a FileConnection is not removed when an application is uninstalled.