Restarting an AIR application

For reasons too complicated and secret to go into here I’m writing an Adobe AIR application that needs to restart itself occasionally. I didn’t find any clear documents describing how to do this but after some reverse engineering and experimentation, here’s what I came up with.

The air.swf movie that’s used by web pages to install and launch AIR applications calls some internal, undocumented APIs to do this, and so can you!

namespace {
  import adobe.utils.ProductManager;
  import mx.core.Application;
  public class Restart {
    public static function restart() : void {
      // request that a new instance of the application be launched
      new ProductManager('airappinstaller').launch('-launch ' + 
        Application.application.nativeApplication.applicationID + ' ' +
      // exit the current instance

I don’t know if or when this will break but it’s pretty straight-forward, once you work it out. It feels to me like there might be some kind of race condition, but it seems to work alright. Oh also, I’ve only tried this on Mac.

3 replies on “Restarting an AIR application”

  1. I’m sorry I don’t have any suggestions and I don’t work on this codebase anymore. I heard there were some Flash updates that broke some stuff but I’m not sure if it was this specifically.

Comments are closed.