Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Chouman82
Posts: 28
Registered: ‎07-21-2008
My Device: Not Specified

Question regarding PersistentStore in 4.3.x

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?

 

 

Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Question regarding PersistentStore in 4.3.x

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 {}

Please use plain text.
New Developer
Chouman82
Posts: 28
Registered: ‎07-21-2008
My Device: Not Specified

Re: Question regarding PersistentStore in 4.3.x

Is there a reason for blackberry to not removed the hashtable?  or it just simply does not know that it's created by my app and therefore not removing it?
Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: Question regarding PersistentStore in 4.3.x

[ Edited ]

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.

Message Edited by peter_strange on 09-12-2008 10:29 AM
Please use plain text.
Administrator
MSohm
Posts: 14,309
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Question regarding PersistentStore in 4.3.x

That is correct.  This link explains this further.

 

How To - Handle stored data when removing an application
Article Number: DB-00424

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800708/800647/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.