Main menu:
When making software, programmers generally need to release the product multiple times. Sometimes these releases fixes critical bugs, add new features, or some other combination. One of the hardest things to do is to get the end-user to update software manually. So the easiest way to push an update is to let the software update itself! This tutorial will teach you the underlying principles behind adding an auto-update system, address various ways to achieve the feature, and various improvements that can be made after completion of this tutorial.
Quick Links:
Regardless of choice of server, another important aspect is the creation of a database. Some server may require the use of PhpMyAdmin or Linq databases, both of which contain fixed database structures. With respect to Dropbox, this "database" can simply be a plain text file with a fixed structure. A fixed database structure is required for efficient data by external programs. This information contained in this plain text file is what the application will receive. Sorting through to find the necessary data would be almost impossible unless the plain text file had a fixed structure.
If you are working with Dropbox simply create an account and upload a .txt file with any text in the file. You can practice retrieving the data through the Get Object in Multimedia Fusion 2 and Clickteam Fusion via the public (or private) link Dropbox provides for the .txt file.
**Note**
The Get Object only supports the HTTP protocol. As such if the link Dropbox returns begins with https, the Get Object will not successfully receive the data. To correct this, simply exchange the "https" for "http".
The picture to the left explains the logic behind the auto update process, Each rectangular element (starting at the green rectangle) represents a step.
1. The Main Application Starts
2. Receive and parse information for an update check
- If update is available, proceed to step 3
- If update is not available, end the update process and continue with Main Application
3. Download the newly Updated Application from the server
4. Download and open the "Switch Application"
5. Close Main Application
6. Overwrite/Switch the Main Application with the Updated Application
7. Remove the outdated Main Application (if an overwrite was not performed)
8. Close "Switch Application" and open the new Main Application
- Return to step 1.
The purpose of the "Switching Application" is to replace the "Main Application" with the "Updated Application."
The "Switching Application" is required because a file cannot be modified if said file is in use by the computer. As such we must close the "Main Application" and open the "Switch Application" so the "Switch Application" can overwrite the "Main Application" with the "Updated Application."
After the switch between the "Main Application" and the "Updated Application," the final act left is to open the "Updated Application" (which should have the exact name as the "Main Application") to repeat the process all over. If done properly, the application should not have an update available.
In summary, adding an auto-update feature to an application is simple! Just follow and implement these steps:
- Start the main application
- Perform the update check
- If update is available, continue with update process to step 3
- If update is unavailable, quit update process and continue with main application
- Download updated files
- Switch and overwrite the main application with the updated files
- Open the newly updated main application
- - Return to step 1
Keep in mind this tutorial does not cover all aspects of the auto-update process. You must code the application in case the user loses internet connection while downloading, the server is down, or other such hindering scenarios. You may even want to allow the user a choice for the update.
These considerations and more should be considered as you create the auto-update feature. Check out the Tutorial PDF at the top of the page for a deeper explanation the concepts behind this tutorial.