Page 1 of 1

Using the internet to check for update

Posted: Sat Jul 25, 2009 5:41 pm
by andyh1234
Hi Guys,

Im sorry if this has been asked before, Ive been trawling through but with all the version 4 update threads running, I cannot find the answer!

I have an app which at the moment has a version number in it, there is a file on our web server that has the current version number and code that pulls the file from the server, checks to see if a newer version is available and if so tells the user. This bit works well.

However, at that point all I do is launch an update.html page on our webserver so they can download the latest update. What I would like to do is have the software download and install the update.

Whats the best way to do this. Ive thought about writing a small installer app so if an update is available and the user wants to install it, it could fire that off and close itself, then that could download and execute the new installer app. Ideally though Id like a seamless upgrade so the software updates then restarts, no installer required.

Any ideas or suggestions would be gratefully received!

Thanks

Andy

Posted: Sun Jul 26, 2009 9:45 am
by BvG
A very nifty updater can be created by using the "revert" command. You'd need to use the "splash screen approach". Basically, you'd make an app that doesn't do much (besides a splash screen, and your update code). All your apps functions would be in stacks, which the application opens automatically when started. To issue an update, you'd download the changed stacks, and save them with the same name, replacing the old stack. Then you use revert, which makes rev reload the stacks from disk, removing the need to restart your app after an update. Of course this won't allow you to seamlessly update the executable itself, so the less code there is in there, the better.

This is an example, as a dry explanation can be confusing:

Let's say you have a stock ticker app. it consists of two stacks, one to store and navigate various stocks, and the other to connect to an online source of life stock updates. unfortunately the homepage you're using made an update to the way they show the stocks, so you need to make a new version of your app available.

when your app starts, it goes trough these steps, assuming there is an update:
  1. show a splash screen
  2. load the user interface stack from disk
  3. go invisible to the connector stack
  4. each stack checks for newer versions of itself online (yes there is a update for the connector stack)
  5. create a backup of the existing stack (if you're into that total security thing)
  6. download the updated connector stack from the web, and replace the stack on the disk with it.
  7. issue "revert"
  8. user can continue work with the updated app
Now all the stacks are up to date. Of course this could be done by using 'go to stack "xyz.rev"' at the right time, but if that stack is already open there will be conflicts, and it's surprisingly hard to make rev forget a stack it loaded completely. so that approach would force you to create a lot more code for all possible scenarios (for example a user issued update check from a menu).

Make sure to notify your user about what's happening. a web call can hang for a minute or even more, if there is no connection. Also make sure to build a download notification, because a download might be slow, making the customer think the app hangs, if he doesn't get feedback.

Posted: Sun Jul 26, 2009 2:44 pm
by Mark
Hi Andy,

BvG's suggestion is a very good approach, but if you do that,you're stuck with the same standalone all the time. As new versions of Revolution come available, you will want to be able to update the standalone to benefit from new features.

It should be possible to download an installer to the temporary items directory, start this installer and quit the main application. I actually do this with an uninstaller on Windows and Mac OS X. I use the shell and AppleScript to start the uninstaller before quitting the main application.

I also created an installer. I decided to keep things simple, though. Whenever an update is available, people see a message with a request to download a new version from the website. This works fine for smaller projects.

Best,

Mark

Posted: Sun Jul 26, 2009 11:19 pm
by andyh1234
Thanks guys, as always its appreciated.

Andy