Restart an Adobe AIR Application with Code!

Restart an Adobe AIR Application with Code!

For a smaller project, I needed to find a way to restart my Adobe AIR application, this had to be invoked by itself …
After some research I found a working examples, thanks to Flex Internals.

[code lang="actionscript"]
import mx.core.Application;
import mx.core.WindowedApplication;
import adobe.utils.ProductManager;

public function restart():void
{
var app:WindowedApplication = WindowedApplication(Application.application);
var mgr:ProductManager = new ProductManager("airappinstaller");
mgr.launch("-launch " + app.nativeApplication.applicationID + " " + app.nativeApplication.publisherID);
app.close();
}
[/code]

Just make sure your “allowBrowserInvocation” option is turned on (value to true) in AIR application descriptor template
[code lang="actionscript"]
true
[/code]

About the Author

Daan is a Creative-Geek with passion for Adobe Flash , Flex and Air. He loves learning and sharing new techniques! Follow him on Twitter to keep up to date with the Creative-Geeks blog and other subjects. Contact him on e-mail : info[at]creative-geeks.com