1

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?

Tim
  • 1,606
  • 2
  • 20
  • 32

2 Answers2

4

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

Jonathan Fisher
  • 380
  • 1
  • 5
  • Yes it is good solutions. But I need keep information exectly in files. – Tim Jul 06 '12 at 15:02
  • 1
    Jonathan 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
2

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.