How to create updater for AIR application bundled with captive runtime?
Asked Answered
M

4

7

What would be the logic of updating mechanism for AIR application with captive runtime? Application should be distributed for Windows and Mac.

I got stuck here:

Note that this does not necessarily mean that you need to implement your own auto-update mechanism. If you use a commercial tool to create your installer, it may include auto-update mechanisms that you can leverage. On the other hand, if you do need to write your own update mechanism, you should find the URLStream, File, and NativeProcess APIs handy in implementation.

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

Is it something like (for Windows, after app is installed with some .exe or .msi installer):

  1. upon starting app, check for new version
  2. if there is new version, download it
  3. overwrite existing app files and AIR runtime files

It should be forced update, before starting app.

How to overwrite running app? Or to make another app (updater) for replacing files, and after that start main app with NativeProcess?

Marlo answered 2/3, 2012 at 12:39 Comment(0)
H
3

For Windows I use the Native Application Updater

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

and WinRAR SFX archive (.exe) to auto update my captive runtime apps.

Native Application Updater will check the version, download your new exe, close your app and run that new exe.

In the SFX options:

I use absolute path, something like: %USERPROFILE%\AppData\Local\com\thenewkid\appname\

Under "Modes" you can select "Hide All" in Silent Mode. Under "Setup" you get it to run your application.exe after extraction.

You can keep the update size low by removing the Adobe AIR folder until a new version of the SDK becomes available (i.e. just had to push a larger update out recently for 3.3)

For MAC I use Installer. It isn't as silent as the Windows Updater as the user will have to click through a couple installer prompts but it allows you to put it in their home directory so administrative privileged aren't required which is what I find the most useful aspect of captive runtime.

Headwaiter answered 16/7, 2012 at 22:24 Comment(0)
S
2

Basically, you should have your app point to some XML file on your server which will contain things like newest version number, path to new files on server etc.

You can use a separate app to do the restart but keep in mind that since you are using Captive Runtime this will mean another 40-60MB just for the updater (unless you use some non-recommended hacks).

It would probably be better to just prompt the user to restart after you download 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, the EXE is simply a pointer to the XML manifest and the SWF.

You should not be updating AIR runtimes file every time - only for critical updates (since they are large files).

Sail answered 2/3, 2012 at 15:43 Comment(2)
@Nemi: As I said, you can use another Captive Runtime app to perform the restart but depending on your situation that may not be worth the extra 40-60MB. Alternatively, you can try this but I recall having trouble getting that to work (pretty sure I never actually got it working properly).Sail
I agree for another captive, to much MBs. That linked restart method didn't work for .exe but it works for .air files, so unusable for what I am trying to do.Marlo
R
1

For the restarting of AIR in captive runtime this works for me on Mac (have not checked for Windows yet) (Note: UpdateAutoTest was the name of my app):

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();
Ramin answered 9/1, 2013 at 15:39 Comment(0)
K
0

There is no need to overwrite. Have the user download your new package and launch it. AIR will know that package is already installed as a previous version and will prompt the user if he wants to update. So the workflow is : check if there is a newer package, alert the user there is one, have him download and launch it. Air will manage the updating.

Kalvin answered 2/3, 2012 at 14:36 Comment(1)
Sorry I didn't put: It should be forced update, before starting app. I don't know if I understand your answer... it is captive runtime, I can't use AIR update framework.Marlo

© 2022 - 2024 — McMap. All rights reserved.