09-11-2008 08:13 PM
Does the PersistentObject that xxx application created gets wiped if the application is removed from the phone?
It doesn't seem to get removed from my device.
The reason I am asking is that when my application starts, I checked to see if the Persistentobject associates with a certain key exists. If it doesn't I assume it's a new install then I read all the property from my jad file. And if the PersistentObject exists I will read all the properties from it instead.
This is how i check if thePersistentObject exists
public boolean exists()
{
synchronized(_object)
{
if ((Hashtable)_object.getContents() == null)
return false;
else
return true;
}
}
Right now, even if i removed the application and install it again the application still reads from the PersistentStore.
Any suggestions?
09-11-2008 08:20 PM
Say your persisted data is a Hashtable. If it's a java.util.Hashtablethen it will live in the peristent store even after your app is uninstalled (as you're seeing). If you create your own marker Hashtable (simply by extending it and making it part of your namespace) then it should be removed from persistent store when your app is removed. So you'd want to persist something like this:
class MyPersistableHashtable extends Hashtable {}
09-11-2008 09:10 PM
09-12-2008 05:28 AM - edited 09-12-2008 05:29 AM
You are correct in what you say - the BlackBerry does not know that the HashTable is created by your app and so the HashTable is not removed.
09-12-2008 11:09 AM
That is correct. This link explains this further.
How To - Handle stored data when removing an application
Article Number: DB-00424