How to create an update for an AIR application bundled with broken runtime?

What will be the logic of the update mechanism for an AIR application with idle runtime? The application must be distributed for Windows and Mac.

I'm stuck here:

Please note that this does not necessarily mean that you need to implement your own automatic update mechanism. If you use a commercial tool to build your installer, it may include automatic update mechanisms that you can use. On the other hand, if you need to write your own update mechanism, you should find the URLStream, File, and NativeProcess APIs that will be useful in the implementation.

after reading: http://www.adobe.com/devnet/air/articles/air3-install-and-deployment-options.html

This is something like (for Windows, after installing the application using any .exe or .msi installer):

  • when starting the application, check for a new version
  • if there is a new version, download it
  • overwrite existing application files and AIR runtime files

Before starting the application, there must be a forced update.

How to overwrite a running application? Or create another application (updater) to replace the files, and then start the main application with NativeProcess?

+6
source share
4 answers

For Windows I use Native Application Updater

http://code.google.com/p/nativeapplicationupdater/

and the WinRAR SFX archive (.exe) to automatically update my current applications while they work.

Native Application Updater will check the version, download your new exe, close your application and launch this new exe.

In SFX options:

I use an absolute path, for example:% USERPROFILE% \ AppData \ Local \ com \ thenewkid \ appname \

In the "Modes" section, you can select "Hide All" in the "Silent" mode. In the "Settings" section, you can run the application.exe application after extraction.

You can reduce the size of the update by deleting the Adobe AIR folder until a new version of the SDK appears (i.e. you just had to increase the last update by 3.3)

For MAC, I use Installer. This is not as quiet as Windows Updater, as the user will have to click a few hints with the installer, but this will allow you to put it in your home directory so that there are no administrator privileges, which is what I find the most useful aspect at runtime.

+3
source

Basically, your application should point to some XML file on your server that will contain things like the latest version number, the path to new files on the server, etc.

You can use a separate application to restart, but keep in mind that since you are using Captive Runtime, this will mean another 40-60 MB only for updating (unless you use some not recommended hacks).

It would probably be better to just ask the user to restart it after downloading the update.

The trick is not to overwrite the EXE, but instead to overwrite the SWF (and any other files that need updating). From what I can tell, an EXE is just a pointer to an XML and SWF manifest.

You should not update the AIR runtime file every time - only for critical updates (since these are large files).

+2
source

To restart AIR in idle runtime, this works for me on a Mac (not tested yet for Windows) (Note: UpdateAutoTest was the name of my application):

var appLauncher:File; appLauncher = new File(File.applicationDirectory.nativePath).parent.parent.resolvePath("Contents").resolvePath("MacOS").resolvePath("AutoUpdateTest"); var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo; npInfo.executable = appLauncher; var _args:Vector.<String> = new Vector.<String>; //_args.push("-a"); //_args.push(); npInfo.arguments = _args; var np:NativeProcess = new NativeProcess; np.addEventListener(NativeProcessExitEvent.EXIT, npExitHandler); np.start(npInfo); exit(); 
+1
source

No need to rewrite. Ask the user to download the new package and run it. AIR will know that the package is already installed as a previous version and will tell the user if he wants to upgrade. So, the workflow: check if there is a new package, warn the user that he is, ask him to download and run it. Air will manage the update.

0
source

Source: https://habr.com/ru/post/909816/


All Articles