I have blackberry app (java). My app stores some informations in files (file:///store/home/user/app_name/). When user removes app, these files don't delete. I want to delete files when app is removed by user. What is solution?
-
There is no standard callback method that notifies the MIDlet that it is being removed. Maybe a Blackberry specific API? – Telmo Pimentel Mota Jul 06 '12 at 17:43
2 Answers
Don't store files this way - use Persistable for your app data instead: http://docs.blackberry.com/en/developers/deliverables/17952/Storing_objects_persistently_1219782_11.jsp

- 380
- 1
- 5
-
-
1Jonathan in cases when there's a lot of data/objects to be stored PersistentStore is not a suitable place. Filesystem on media card is far more better. It is because PersistentStore is a limited storage, and it consumes memory shared with operating system. And when there's insufficient memory for OS, then device works unstable. – Jul 06 '12 at 18:17
There are two "standard" ways to uninstall an application. The first, via Options - Applications
menu. And the second, via javaloader -erase -f
command.
Theoretically you can intercept the uninstall event for the first way (when you use "Options - Applications" menu), but you need additional application that receives this event and does the cleanup action.
To intercept and recognize an unknown event I do the following.
I write a simple BlackBerry app, that implements and uses GlobalEventListener and runs in background, and prints every intercepted global event guid to the system output and/or log with timestamps.
Now, uninstall your app from Options menu and inspect logged global event guids. After that install/uninstall another applications. And then inspect log/system output window to find out which events are related to uninstall
action.
It does not guarantee 100% result, but at least you will get fun with coding, logging and exploring.