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
Contributor
Posts: 20
Registered: ‎03-09-2010
My Device: Blackberry Bold
My Carrier: SingTel

Persistable Object is still stored in Blackberry after deletion of app

Hi all.

 

I have an app, say MainApp which imports a library jar file, i.e. MyJar.jar. In the library, some data will be stored in the device using Persistent Store.

 

To ensure that the persisted data are cleared after i delete the app, I wrote a custom class to be used for the storage. The custom class code is as below:

 

import net.rim.device.api.util.Persistable;

public class StoredData implements Persistable {
    private String save;
    
    public StoredData(String save) {
        this.save = save;
    }
    
    public String getData() {
        return save;
    }
} 

 

 

 

 

InMyJar, the custom class is used for storing data as below:

 

       
        persistentObject2 = PersistentStore.getPersistentObject(Key2);
        
        if (persistentObject2.getContents() == null) {
            //Do something to generate the data to be stored
            stored = DoSomething();
            
            Data2 = new StoredData(stored);
                        
            persistentObject2.setContents(Data2.getData());
            persistentObject2.commit();            
        }
        else {
            stored =  (String) persistentObjectClientId.getContents();
        }
    
        

 

After building and signing both MainApp and MyJar (i also preverified MyJar.jar before it being imported), i used JavaLoader to load both MainApp.cod and MyJar.cod into my BlackBerry Bold 9000.

 

I run the app and two data are being stored in the Persistent Store.

 

I keep track of the data stored in Persistent Store by  HTTP calling a PHP program  which  logs those data into a MySQL table. For each new installation of the app, the data stored in the device are different.

 

Then, i deleted MainApp.cod  and MyJar.cod from the device by "delete" selection from the menu and i ensured i can't find both of them in Applications list and Modules list.

 

Then, i reload both of them with JavaLoader again and run the app. I noticed that the data stored in the Persistent Store still persists although the app was deleted already.

 

I'm using JDE 4.7.0.41 in Win XP SP3.

 

Please advise how i can solve this.

 

Thanks.

 

 

 

 

Developer
Posts: 571
Registered: ‎04-11-2009
My Device: BB 10 Dev Alpha

Re: Persistable Object is still stored in Blackberry after deletion of app

Hi,

 

When you delete your application from Applications list the Persistent Store doesn't gets deleted. You will have to delete the Persistent Store manually by writing :

 

  PersistentStore.destroyPersistentObject( yourLongKeyOfPersistentStore );

 

Otherwise, you will have to wipe the device, which will remove Persistent Database.

 

Thanks,

Kanak

Regards,
Kanak Sony
------------------------------------------------------------------------------------------
http://dodevelopnshare.wordpress.com/ | http://www.linkedin.com/profile/view?id=188131481&trk=tab_pro
Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Persistable Object is still stored in Blackberry after deletion of app

that is not correct kanaksony, custom persistant objects should be removed when uninstalling an application.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 59
Registered: ‎07-05-2010
My Device: Blackberry 9800
My Carrier: Airtel

Re: Persistable Object is still stored in Blackberry after deletion of app

 


kanaksony wrote:

Hi,

 

When you delete your application from Applications list the Persistent Store doesn't gets deleted. You will have to delete the Persistent Store manually by writing :

 

  PersistentStore.destroyPersistentObject( yourLongKeyOfPersistentStore );

 

Otherwise, you will have to wipe the device, which will remove Persistent Database.

 

Thanks,

Kanak


 

Sorry Kanak, you are wrong. He is using an application specific class to store the persistent data, so it should be removed when the app no longer exists as per the bb documentation.

Please refer

http://supportforums.blackberry.com/t5/Java-Development/How-to-Delete-Persistent-Store-When-App-is-U...

 

I wonder why it is not getting deleted. May be some expert can shed a light on this.

-Shankar
Developer
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810
My Carrier: WiFi

Re: Persistable Object is still stored in Blackberry after deletion of app

 


playplay1978 wrote:

Hi all.

 

 

Then, i deleted MainApp.cod  and MyJar.cod from the device by "delete" selection from the menu and i ensured i can't find both of them in Applications list and Modules list.

 

 


Have you restarted your device (battery pull) after uninstall? You should have seen prompt Reboot Now/Reboot Later

 



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry
Contributor
Posts: 20
Registered: ‎03-09-2010
My Device: Blackberry Bold
My Carrier: SingTel

Re: Persistable Object is still stored in Blackberry after deletion of app

I didn't restart after uninstall. There's no prompt for Reboot Now/Reboot later.

 

Fyi, both MyApp.cod and MyJar.cod appear in Options->AdvancedOptions->Applications->Modules and there is no "Delete" for the 2 modules once i click blackberry button.

Ok. So, i deleted the App from "Downloads". Only MyApp.cod was removed from "Modules" while MyJar.cod was still there. Then, i restarted the device and pulled out the battery although there's no prompt for Reboot.

 

After restart, i checked on the Modules, MyJar.cod is still there.So, it seems likes the app was not removed completely as MyJar.cod is still there. So, the persisted object is still in the device is probably due to this.

 

I apologise that i wrote the scenario wrongly in my initial post.

 

By the way, how can i remove MyJar.cod from Modules? I read somewhere that no "Delete" on the menu for specific modules is probably due to unclean code.

Can someone shed some lights on that for me?

 

Thanks.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Persistable Object is still stored in Blackberry after deletion of app

[ Edited ]

How did you install this?

 

I find javaloader useful in this sort of circumstance. 

 

But I don't like using javaloader so generally install using OTA or Desktop Manager, even when testing, and don't have problems like this. 

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Persistable Object is still stored in Blackberry after deletion of app

Since you used javaloader to install the files, they will have to be deleted separately. Since the library is only a module, you will need to use javaloader. As peter suggested, installing OTA should allow you to remove both from the applications list.

Contributor
Posts: 20
Registered: ‎03-09-2010
My Device: Blackberry Bold
My Carrier: SingTel

Re: Persistable Object is still stored in Blackberry after deletion of app

Thanks, all.

 

Ok. This time, I used JavaLoader.exe -u -f erase to delete MyApp.cod and MyJar.cod from my device. That's followed by restart (with battery pulling).

 

Then, i reinstall the above 2 cods with JavaLoader.exe -u load. Then, i run the app. Unfortunately, the Persistant store still persists as my PHP never catches the new data which will write to a table. The data are generated with an algorithmn which will ensure uniqueness. And, for each run of my app, it will check whether that Persistent store exists. If it's not, it will create it and so on.

 

Probably, my code has something to be corrected.

 

Any idea?

Contributor
Posts: 20
Registered: ‎03-09-2010
My Device: Blackberry Bold
My Carrier: SingTel

Re: Persistable Object is still stored in Blackberry after deletion of app

Hi all.

 

Anybody has any idea on this?

 

I'm still trying.

 

Thanks again