在黑莓设备上测试 - 多次添加和删除应用程序
对于许多人来说,了解如何在测试时从设备中完全删除应用程序会很有用。 我现在已经多次下载我的应用程序,同样也多次删除它。问题是删除应用程序时,它不会删除与我的应用程序相关的持久对象或通过应用程序下载的图像等内容。因此,当我下载下一个版本时,我不知道是否有与构建持久对象或获取图像相关的问题发生,因为这些元素已经存在于上一个版本中。 我不知道这是否是缓存的事情。我不知道这是否是预期的,我必须在删除应用程序后使用一些实用程序来擦除这些数据。我无法通过基本的网络搜索找到太多信息。
任何信息将不胜感激。
黑莓 Bold 9000。4.6 操作系统。使用SD卡和不使用SD卡进行测试。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果项目中定义了存储在 PersistentStore 中的对象的接口,则它们会在卸载时自动删除。如果它们来自标准 BlackBerry API,那么它们将一直存在,直到被删除。 EG,如果您将字符串保存在 PersistentStore 中,它将保留在 PersistentStore 中,但如果您保存您创建的类,它将在卸载时被删除。因此,如果您想让这些对象自动删除,只需创建一个包装类并保存它。
存储在文件系统上的图像将不会被删除,直到您或某些应用程序删除它们。但是,您应该很容易编写一个清除所有内容的应用程序。
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.
您可以实施的另一个解决方案是让您的应用程序对其数据有一定的自我意识。
创建一个包含“Version”的简单字符串值,您可以将其保留在哈希表中(或者可以选择将其保留在哈希表中,以便可以通过这种方式存储许多属性)。
GUI 应用程序启动时,将存储的“版本”与应用程序的当前版本进行比较。如果存储的版本不存在,或者存在且匹配,则不采取任何操作。
如果存在且不匹配,则自动清理旧的持久数据;或者提示用户是否希望删除该数据(哪一个更好取决于您的实现)
您还可以使用 CodeModuleListener 监听卸载事件 - 当发生这种情况时,您可以在那时进行清理以及或替代。
(顺便说一句,我实际上正在为 Blackberry 开发一个可共享库,它使管理持久性以及桌面数据备份/恢复变得更加容易。我正在将其作为 BBSSH 项目的一部分,但我将把它分成一个单独的核心组件库,并在双重 GPL/可选商业许可证下发布它,它将包含用于数据清理和数据版本控制的钩子。
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. )