开发者

Testing on blackberry device - adding and removing app multiple times

It would be useful for many people to know how to completely remove an application from your device when testing. I have downloaded my app many times now, and likewise have deleted it many times. The problem is when deleting the app, it does not remove things like the persistent object related to my app, or the images downloaded through the app. So, when I download the next build, I have no idea if something broke that is related to building the persistent object or fetching the images since those elements already exist from the last build. I don't know if this is a cache thing. I don't know if this is expected and I have to use some utility to wipe this data 开发者_C百科after deleting the app. I can't really find much info through basic web searches.

Any information would be appreciated.

Blackberry Bold 9000. 4.6 OS. tested with both SD card and no SD card.


Objects stored in the PersistentStore are automatically deleted on uninstall if their interfaces were defined in your project. If they are from the standard BlackBerry API then they will stick around until they're deleted. E.G if you save a String in the PersistentStore it will stay in the PersistentStore but if you save a class you created it will be deleted on an uninstall. So if you want to have those objects be deleted automatically just create a wrapper class and save that.

Images stored on the filesystem will not be deleted until you or some application deletes them. However, it should be easy for you to write an app that clears everything out.


Another solution you could implement is making your app somewhat self-aware of its data.

Create a simple String value that you persist (or optionally, persist it in a Hashtable so you can store many properties this way) that includes "Version".

At startup of the GUI app, compare the stored "Version" against the application's current version. If the stored version doesn't exist, or if it exists and matches, take no action.

If it exists and does not match, automatically clean up old persisted data; or alternatively prompt the user to see if they want that data to be deleted (which one is better will depend on your implementation)

You can also use CodeModuleListener to listen for an uninstall event -- when that happens, you can clean up at that time as well or instead.

(As an aside and a bit of shameless self promotion, I am actually currently working on a shareable library for Blackberry that makes managing persistence much easier, as well as desktop data backup/restore. I'm doing this as part of the BBSSH project, but I'll be splitting it off into a separate library of core components and publishing it under a dual GPL/optional commercial license. It will contain hooks for data cleanup and data versioning. )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜