views:

96

answers:

1

I'm creating an app that uses SQLite as a data storage on BlackBerry OS 5.0. When it is removed from a device, I'd like to be diligent and remove the database from the phone.

Although I can seem to find out plenty of information on Persistant Storage being removed on the removal of an app, I can't find anything about an SQLite database.

Does anyone know a way of removing the database? By default, I'd be storing it on external media (SD Card) but information on removing it when storing it on eMMC-enabled devices would get an up-vote too.

Thanks!

+1  A: 

The 5.0 API has a new class called CodeModuleListener which you can implement and use with CodeModuleManager.addListener() to detect when your application module is being removed from the system. That would be a good time to delete your data.

Marc Novakowski
Does that mean my application has to run in the background?
Spedge
I'm not sure - the API doesn't say. It should be easy enough to try it and find out...
Marc Novakowski
Ok, I'll give it a go - and mark your answer as correct once I've tried :)
Spedge
I can't seem to get this to work unless the app is running - which seems kinda backwards. Any other advice?
Spedge
You might have to keep a non-UI (system) background thread running in order for that API to work.
Marc Novakowski
Although this is a good answer, it's not going to work with the "background process" running.
Spedge