Using InvokeEvent.reason in AIR 1.5.1

AIR 1.5.1, released today, is not quite a typical dot release containing just bug fixes. It also contains one minor—albeit useful—new feature.

Applications can already detect when they’ve been invoked by listening for the InvokeEvent that is dispatched by NativeApplication. This is dispatched when they’re started from the command line, via the GUI, or by opening an associated file.

Applications can also register to be launched automatically during user login. However, prior to 1.5.1, there was no reliable way to distinguish this login case from the the other reasons an application might be started. That turns out to be awkward: In the login case, applications often want to avoid opening new windows. In all other cases, they generally want to make sure they do open a new window.

Starting with AIR 1.5.1, the InvokeEvent class contains a new property, “reason”, that distinguishes between these two cases. It has two possible values: “standard” and “login”. These are, I hope, self-explanatory.

Note that in order to use this new API, you must update your application to use the AIR 1.5.1 namespace by changing its descriptor. (There are no other changes to the descriptor schema in this release.) The new descriptor will trigger an auto-update to AIR 1.5.1 should someone attempt to install your application against an older version, thus guaranteeing that the new API will actually be available.

3 Responses to Using InvokeEvent.reason in AIR 1.5.1

  1. wrobel221 says:

    Hi.Thanks for that info. I’ve used it in my AUG presentation. Visit my blog for an example app using it. The app is just under the code part.

  2. KJ says:

    You’re saying that with this new feature I can automatically launch an AIR application on a users machine when they log in?[Yes, that’s right. —Oliver]

  3. MimiQ says:

    Hi and thanks for your post. I’m doing a project for university and this information was very useful for my research. A Stumble for your efforts 🙂