Display AIR version

When we were building our internal employee directory application we found a need to help determine what AIR version our employees had installed. With the following method you can enable end users to easily determine their AIR version right inside your application.
 
As an AIR application developer you can display the AIR version right in your application and make identifying this information for your users easier.
 
Some benefits of Displaying AIR runtime version in your applications: -

  • Troubleshoot application/runtime specific issues.
  • Helps identify pre-release or labs version of AIR runtime.
  • Troubleshoot air update framework related issues.

 
The NativeApplication class in the AIR SDK represents the currently running air application. The NativeApplication object is a singleton object, created automatically at startup and provides application information, application-wide functions, and dispatches application-level events. To get the NativeApplication instance of an application object refer with the static property NativeApplication.nativeApplication.

Code:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
public function get airRuntimeVersion() : String
{
return NativeApplication.nativeApplication.runtimeVersion ;
}
public function get airRuntimePatchLevel() : int
{
return NativeApplication .nativeApplication.runtimePatchLevel ;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Label text='{ "AIR " + this.airRuntimeVersion + " Patch Level " + this.airRuntimePatchLevel }' />
</s:WindowedApplication>

I hope this small code is useful for you.

Comments are closed.