views:

400

answers:

3

Hi

I wish to store a single variable in my application that will be saved between runs. This will be a version number that will be used to trigger an update option and so will change only rarely.

Does anyone have suggestions on the best way of implementing this? Considering it's such a simple requirement I am interested in the simplest solution.

Thanks!

+3  A: 

Normally, that sort of information will be held in a constant (not a variable) in the binary, and the binary will contact an external site to find out whether there is a more recent version of the software. When it downloads the new, the newly downloaded file will have a new constant embedded in it.

Alternatively, you could keep the information in some sort of file in the file system. I'm not familiar with the Symbian environment, but something similar most likely exists.

Jonathan Leffler
A: 

good thinking, should've got there myself really...

adam
A: 

It has already been mentioned, so I am going to elaborate on it. Create a file in your project directory that will contain the version number. Make that file a part of final SIS file by adding a line about it in the PKG file---for example, put a line in the PKG file to tell the installer to copy the file to a place like c:\System\Apps\${AppName}\${filename} on the device. Within code, read the version number from that file. The advantage you will have from doing it this way is that when you update your code and edit the file in your project directory and recreate an updated SIS file, on updating the SIS on the device, the version file will automatically get replaced with the current one.

ayaz