04-19-2010 10:32 AM
I am developing a new version of an existing application. The prior version stored data in the persistent RecordStore of the device. When a user installs the new version of the application, they get a prompt saying something like "Persistent data is stored on the device. Would you like to retain this data?".
If the user answers Yes, the app will continue to use old data that was persisted by the original version of the application. This is not what I need to happen.
If the users answers No, the app will wipe the old dat and rebuild the persistent store with my current data. This is the course of action I want to application to take every time.
Since there is no way to guarantee that every user will select "NO" to this prompt, is there any way to configure the new version so that the data is not retained automatically?
What other options are there for dealing with this situation?
Solved! Go to Solution.
04-19-2010 11:23 AM
if you store custom classes (implement persistable) they get removed on uninstallation.
you can also change them for every version to be sure that not the old version is used.
04-19-2010 11:38 AM
Unfortunately, I don't have any contol of what the original version of the app saved. I do know that they did NOT save custom classes. So they do not get removed on uninstallation.
Also, from an OS perspective, does an upgrade from an old version of an app to a new version of the app follow the same procedure as an uninstallation and reinstallation of a new app?
04-19-2010 12:16 PM - edited 04-19-2010 12:20 PM
If the app can access the old data, why not just delete it when the new app runs? To distinguish old from new, you can design the new data to contain some signature value that won't be present in the old data. (For instance, you can define your record store to have record 1 always contain record store version data, in a format unlikely to be present in earlier formats.)
An upgrade does not (usually) follow the same procedure with respect to persistent data as an uninstall/install sequence. However, there have been occasional posts here about upgrades apparently losing persistent data that was meant to be preserved. I'm not clear about exactly what causes that, but it's not considered the norm.
P.S. If you're using RecordStore instead of Persistable, custom classes are irrelevant. The record store gets deleted when all MIDlets in the MIDlet suite that created the record store is uninstalled.
04-19-2010 12:25 PM
Thanks Ted. That is the approach I will use to force my data to reload.
Regarding your last comment:
"P.S. If you're using RecordStore instead of Persistable, custom classes are irrelevant. The record store gets deleted when all MIDlets in the MIDlet suite that created the record store is uninstalled."
What happens to the RecordStore when the application is updated? I guess it just depends on the user's answer to the message box I described in my first post.
Thanks again for your help.
04-19-2010 12:35 PM
I only have experience using RecordStore on non-BB devices; I've never dealt with the message you described in your original post. I suspect that you are right about it being up to the user. I'm surprised, though, that BB decided to routinely throw a question like that at users who will likely have no concept of how to choose an answer.
BTW, is this an MIDP MIDlet or a CLDC (UiApplication-based) application? I'm now wondering if that prompting behavior is different for the two.
04-19-2010 01:07 PM
Its a MIDlet, but there is no reason that it needs to be. It has BB specific API calls all over the place. It really wasn't designed well from the start. I am planning on rewriting the whole thing from scratch.
04-19-2010 02:19 PM
Oh no....looks like the problem is worse than I thought.
Turns out that my problem is not entirely related to objects in the RecordStore. Instead, the problem looks like it relates to data files packaged with the application as resources.
If the same resource existed in the original version of the app, and that resource is updated in a new version of the app, I would expect it to get replaced when the app is upgraded. However, if the user selects "Yes" indicating that they want to retain the application data, it looks like the resource is not getting updated.
Is this possible? I don't know how the BB OS saves resources that are bundeld with the app. Shouldn't they get overrwritten when new versions are installed?
04-19-2010 03:53 PM
Resources (including data files) packaged with an app are replaced when a new version of the app is installed. The only way I can think that this might not happen is if they were packaged in a separate module that was for some reason not updated along with the rest of the app. What does the .jad file for the app look like?
Are you sure that the problem really is that bundled resources aren't being updated? Some apps are written to copy resource data that comes packaged with the app into persistent store. Maybe it's the outdated copy that's being retained.