Autoupdater   >   About   >   Adding AutoUpdater to Your App

Adding AutoUpdater to Your App

This section covers adding AutoUpdater to your existing Omnis Studio application.

File Structure

The strategy behind AutoUpdater is that the user opens the AutoUpdater library rather than opening your application's library(s).

This gives the AutoUpdater library a chance to:

  1. Check to make sure all the files which are supposed to be included in the application are present, and if necessary, download and install any missing files.
  2. Check for any newer version files on the files server, and if necessary, download and replace any older version files.

AutoUpdater then opens your application's main library. Your application's main library is responsible for opening any additional libraries if you have a multi-library app.

In order to make it simple for your runtime users, it is recommended that you do the following to set up your application for use with AutoUpdater.

  1. Create a new empty folder. Name it an appropriate name, such as your application's short name. e.g. MyAmazingApp In this AutoUpdater documentation we refer to this folder as the APP folder.
  2. Put a copy of the AutoUpdater library inside the APP folder. Rename to an appropriate name that makes sense to your users. e.g. open_MyAmazingApp or MyAmazingApp_AutoUpdater. This is the file your users will double-click to open your application on their computer.
  3. Create a subfolder inside the APP folder. Name it libraries.
  4. Drag your application's files and folders inside the libraries folder. Your application's main library (the one users used to double-click to open your application) must be located directly inside the libraries subfolder.
Note

Some developers have indicated that they want to copy the AutoUpdater library classes into their own main library, negating the need for a separate AutoUpdater library. Theoretically this is possible to do, however, I have not attempted to do this with any of my own applications. Doing so would mean that whenever your main library is updated you will have to do a self-update... a tricky operation.

Copy Classes

There are a few AutoUpdater classes which you need to copy to your application's main library.

  1. Open the AutoUpdater library located in your APP folder using your developer version of Omnis Studio.

    Warning

    Never open the AutoUpdater library in your development APP folder with a runtime version of OMST! Doing so could cause your development libraries to be overwritten with the last version of the libraries on the files server. Not a good thing!

    AutoUpdater will not download files from the files server if you are using a developer version of Omnis Studio.

  2. When AutoUpdater asks if you want to open the main library, click the Yes button. All going well your application will be opened.
  3. Press F2 to open the F2 Browser.
  4. Expand the AutoUpdater library node under the Libraries node of the F2 Browser. (The AutoUpdater library will be whatever file name you gave it.)
  5. Select the Copy to Main Library folder in the F2 treelist.
  6. Drag the mAutoUpdater and the oAutoUpdater classes to your application's main library.

Menu Lines

You will now add a menu line to one of your application's menus to give your runtime users access to sending messages to your application's AutoUpdater library.

  1. Add a menu line to your application's main menu or your application's help menu.
  2. Select the added menu line and set the following properties for the new menu line:
    • $cascading - select the mAutoUpdater class
    • $name - enter AutoUpdater
    • $text - enter Updates... or whatever is appropriate to your local language.
  3. Remove and reinstall the menu.
  4. Select the Update Preferences... line in the Software Updates cascading menu. All going well the runtime AutoUpdater Preferences window will be opened.

    RuntimeMenu.gif

Tip

You can change the menu line $text properties of the mAutoUpdater menu to suit your local language.

Preferences

The next step is to set up the AutoUpdater Preferences for your application.

  1. From the AutoUpdater menu, select the menu line for your application.
  2. The Preferences > Developer tab will already be selected.
  3. Enter the full name of your application in the Application Name field. As you enter the application name the window title and AutoUpdater menu line will be updated.
  4. Enter the short name of your application in the Package Name field. If you have different version of your application for different clients append a client's ID to the package name.

Files Server - Database Settings

The next step is to set up the files server for your application.

If all of your users are operating on a local network with a common database it is recommended that you use a database as a files server. A database files server is much faster than an FTP files server.

To set up a database as a files server:

  1. Create a database named autoupdater using your database's administration tool.
  2. If required by your database create a user who has authority to create tables in the autoupdater database.
  3. Select the Preferences > Files Server tab
  4. Click the Ping Server button. All going well, AutoUpdater will logon to your autoupdater database and immediately create the tables it needs.

Files Server - FTP Settings

To set up an FTP server as a files server:

  1. Create an autoupdater folder on your FTP site.
  2. Create an ftp_autoupdater user on your FTP site with a password. The ftp_autoupdater user should log directly into the autoupdater directory and not have rights to go any higher in your directory structure.
  3. Under the Preferences > Files Server tab
    • Server Type - select FTP Server
    • Enter the remaining fields as appropriate for the FTP files server you have prepared.
  4. Click the Ping Server button to make sure AutoUpdater can ping your FTP files server. (Provided your files server will respond to TCPPing)
  5. Click the Connect button to make sure AutoUpdater can FTPConnect to your FTP files server.

Create Package

Create and upload your first package in the same manner as you did in the Quickstart Tutorial.

  1. Select the Package Builder/Editor tab.
  2. Click the Prepare Package & Files button.
  3. Click the Upload Package and Files... button.
  4. All going well your package and files will be uploaded to (inserted into) your autoupdater database.
Your application is now AutoUpdater savvy!

Distributing your Application

Distributing your AutoUpdater savvy application to runtime users who have Omnis Studio installed on their computer is easy.

  1. Copy your AutoUpdater library to an empty appropriately named folder. e.g. MyAmazingApp
  2. Copy the folder with the enclosed AutoUpdater library to the runtime computer.
  3. Open the AutoUpdater library using a runtime version of Omnis Studio.
  4. AutoUpdater will connect to the specified files server and download and install all the files specified by the package.
  5. Each subsequent time the runtime user opens their AutoUpdater library, newer version files will be downloaded and installed prior to opening the application.

Summary

That covers the basics for adding AutoUpdater to your application, setting up your own files server, and distributing your AutoUpdater savvy application.

For a more in depth understanding of AutoUpdater and additional features read the Technical Documentation section.