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
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN
Accepted Solution

RecordStore and PersistentStore

Hi,

 

When an user uninstall or delete an BB app from the device the data from RecordStore or PersistentStore are deleted also ? How does it works ?

 

Thanks in advance!

 

................................................................................................
Tech On!
PTNews
more at On On On!
Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: RecordStore and PersistentStore

A RecordStore is always deleted when the app that created it is uninstalled. A PersistentStore may or may not be deleted. It depends on the class of the persisted object. If it is a class defined by the app, then it should be deleted, but if it's a generic persistable object, then it will stay in the system until explicitly deleted (or the device is wiped).




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Contributor
Posts: 13
Registered: ‎03-30-2010
My Device: 8520
My Carrier: 3

Re: RecordStore and PersistentStore

If you want to delete whole application data upon uninstalling (using PersistentStore), you might want to try this : 

http://stackoverflow.com/questions/2879406/how-to-delete-application-data-on-install-and-reinstall

 

Best Regards,

 

Ari

New Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile

Re: RecordStore and PersistentStore

Will RecordStore data be deleted when device restarts?
Developer
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: RecordStore and PersistentStore

No

New Developer
Posts: 126
Registered: ‎06-09-2010
My Device: 9000
My Carrier: T Mobile

Re: RecordStore and PersistentStore

Haha. Kudo for you BB-Dude Smiley Very Happy
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Re: RecordStore and PersistentStore

Hi Ted_Hopp,

 

Thanks.

What do you mean by "generic persistable object" ?

Here is the code i'me using:

---------------------------------------------------

public class DataContext {

    private PersistentObject persistentObject;
    private Hashtable settingsTable;

    public DataContext() {    
    
        persistentObject = PersistentStore.getPersistentObject(0x153b18899713a05L);

        synchronized(persistentObject) {

            settingsTable = (Hashtable)persistentObject.getContents();
            if (null == settingsTable) {
                settingsTable = new Hashtable();
                persistentObject.setContents(settingsTable);
                persistentObject.commit();
            }
        }                
    }

    public Object get(String key) {            
        return settingsTable.get(key);                
    }

    public void set(String key, Object value) {             
        settingsTable.put(key, value);                
    }

    public void commit() {                
        persistentObject.commit();                
    }

 }

------------------------------------

 

By this piece of code can you tell me if my PersistentStore data will be deleted after uninstall ?

 

 

................................................................................................
Tech On!
PTNews
more at On On On!
Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: RecordStore and PersistentStore

I meant an object class that implicitly implements Persistable; these are documented in the API docs for PersistentObject. The opposite would be a class that you define in your code as implementing Persistable.

 

In the code you are using now, the Persistable object is a Hashtable. This will not be deleted when your application is removed. If you want to change that, extend Hashtable with your own class. (As described in the docs for Persistable, you will need to explicitly declare that your subclass implements Persistable.)




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.