Joshua
Joshua

Reputation: 6843

How can I know if an instance of an AIR Application was invoked by the Installer?

When you export a release build of an air app, it creates an .AIR file, that you can then double-click. When you do so, it asks you if you want to "Add shortcut icon to my desktop" and "Start application after installation".

I need to call specific ActionScript within my AIR application if and only if it was launched by the installer (the 2nd checkbox was selected) - As opposed to the user re-running it from the start menu after having installed it.

How can I detect this within my program?

Upvotes: 2

Views: 122

Answers (1)

Rick van Mook
Rick van Mook

Reputation: 2065

With the ApplicationUpdater you can get the isFirstRun property that will return the following:

Whether this is the first run after a successful update (true) or not (false). The updater sets this value during the call to the initialize() method.

Note that this will be true whenever you have pushed an update to your users. If you wan't your check to only return true the very first time the user opens your application (regardless of version number) you could write a file locally and check it's existence when the user opens your application. An example of how this could work can be found here:

http://www.mikechambers.com/blog/2007/11/07/detecting-whether-an-air-application-has-run-before/

Upvotes: 2

Related Questions