An Introduction to AIR
AIR (Adobe Integrated Runtime) is a wrapper around a set of technologies that enables developers to build rich Internet applications that deploy on the desktop. Applications are created using a mixture of JavaScript, HTML, and Flash. The resulting application is delivered to end users in a single package and rendered using the WebKit HTML engine.
AIR applications don't look like what I think of when I think "web application". To me they look and feel like desktop applications. This surprised me a little because when I first heard about AIR I assumed that it would be similar to Prism from Mozilla. I thought that it would be yet another way for established websites to deliver their content directly to users' Desktops. In a way this is true, especially when you see AIR applications like the eBay Desktop, but developers have not restricted themselves to simple website-to-the-desktop applications. The AIR Marketplace, a central repository of AIR applications, has applications for Time Tracking, eLearning, Video conferencing, micro-blogging, news reading, media playing, and on and on and on.
Because AIR applications are built using existing standards (HTML, JavaScript, Flash), they are cross-platform by default (well, almost — more on that later). AIR's goal is to be a true write once, run anywhere environment.
Getting AIR
The Linux alpha version of AIR can be downloaded from http://labs.adobe.com/technologies/air/.
The download is a file with a '.bin' extension. To install it, you first have to make the file executable. This can be done by opening a terminal window and navigating to where you downloaded the file and then issuing the following command:
chmod +x adobeair_linux_a1_033108.bin
Once the file is executable, start the simple installation process from the command line with:
./adobeair_linux_a1_033108.bin
The installer should run and ask you to accept the AIR license agreement.
After clicking on "I Agree" the installer will ask you where
you would like it installed. By default it suggests to install
itself to your /opt
directory. Assuming you keep the
default, after the installation has finished there will be a new
"/opt/Adobe AIR"
directory that contains the "Adobe AIR Application Installer"
program and other miscellaneous files. That's right, you just
installed an installer. On Ubuntu, after installation I also had
a new entry in my Applications > Other
menu.
Using AIR
Now that AIR is installed, you can download and install AIR applications. These applications are delivered in the form of .air files. These files are really .zip files containing everything the AIR Application Installer needs to install the application on to your computer.
AIR users on MacOS and Windows can install applications by clicking on handy "Install Now" buttons on the web pages of the applications they want to install. The alpha version of AIR for Linux can't make use of this feature, so you have to manually download the .air file and then open it with the AIR Application Installer. Firefox can be configured to automatically open .air files with the AIR Application Installer, so for many applications, this isn't a problem because there is usually a direct link to the .air file somewhere on the install page. Some application web sites don't provide the link though, leaving you to do a "View Source" on the web page and search for ".air" to find the file to download.
During the installation of an AIR application, the Installer will first display an "Are you sure?" message letting you know the name of the application, the filesystem and network permissions the application will have, and whether or not the identity of the publisher of the application can be verified.
Click on the install button and the installer will ask where
you want the application installed (/opt
is the
default), whether or not to start the application after
installation is complete, and if you want it to create a Desktop
launcher for the application.
After you click on the Continue button the installer takes the cross-platform .air package and translates the app so that it will run on your system as if it was a traditional application. This install process basically involves the AIR Application Installer unzipping the .air file to the location you specified and then creating a binary executable that loads and runs the application.
Example Applications
Adobe provides links to several example applications, with full source code, at http://labs.adobe.com/technologies/air/samples/. These applications are good examples of the type of things that AIR can do. My favorites of the bunch are MapCache, RoadFinder, PixelPerfect, and ScreenBoard.
MapCache is a Desktop version of Yahoo Maps. The nifty feature it has is the ability to drag the map you are currently looking at to the desktop where it is saved as a .png file. Just grab the "Drag Me" button and drop it on the Desktop.
The RoadFinder application is not very useful, but it is fun. What it does is show you both Google Maps and Yahoo Maps side by side. When you drag or zoom on one, the other does too. By doing this you can readily see how these two map services differ. This can be especially useful if you are trying to find an address in a new development and either Google or Yahoo Maps has not been updated with the street you are looking for.
PixelPerfect is a fun little application whose sole purpose is to act as a Desktop measuring stick. You can drag the edges to make it any size you wish, or click in the top left corner to get a drop down menu that lets you set it to a few standard sizes. You can drag it around your screen to measure whatever you want . . . ok, it's not very useful, but I could see it used by developers when prototyping user interfaces.
The ScreenBoard app is my favorite of the example applications. What this application does is draw a transparent rectangle over your entire screen. You can then draw on the screen using a variety of virtual "markers". You can use the ones supplied, or create your own. Transparency support in your window manager is required for this application to work because without it, you'll just see a big black rectangle covering your entire desktop.
Issues with the Linux alpha
The MacOS and Windows versions of the AIR runtime are further along in their development than the Linux version, so there are several issues present that I hope will be addressed before it is formally released.
One very annoying issue I came across was in the sound output of AIR that caused Rhythmbox, Banshee, and other media players on my system to not be able to play sound, or even crash if there was an AIR application running when they were launched. I was able to work around this to an extent by starting my music player first and then to launch my AIR application(s). When I did that, my AIR applications would not play any sound, but at least I could listen to my music.
Another issue I ran into was that there are several applications, the eBay Desktop I mentioned earlier being one of the more prominent examples, that refuse to install or run with the Linux version of the AIR runtime. This is what I meant when I said that AIR is not fully cross platform. As the Linux version progresses towards its official release, compatibility will increase to the point where all AIR applications will run, but right now some of the more advanced ones are off-limits. It's annoying, but that's the nature of alpha-level not-yet-feature-complete software.
Probably the ugliest issue I ran into was that if you are not running a compositing window manager like Compiz, then AIR applications will be surrounded by an ugly black rectangle at best, and will be completely unusable at worst. Here are some examples of the same application first with compositing and then without.
With Compositing:
Without Compositing:
Most — but not all — AIR applications are like the
one above. They do not use the default window manager's windows.
Instead they use their own custom skins. Some of these skins rely
heavily on transparency to look good and be functional, and
without a compositing window manager you're out of luck. I don't
know that there is a way around this, so if you would like to use
AIR, you should use a compositing window manager. On Ubuntu, I
just enabled "Normal" under System > Preferences >
Appearance > Visual Effects
and transparency worked
fine.
Final Thoughts
There are a lot of application frameworks out there. You have the traditional ones like QT and GTK, newer ones like Mono (aka .Net), and now there's a new breed of frameworks like AIR that aim to integrate our Desktops with the Internet in ways that would have been unheard of just a few years ago.
The choice of whether or not to develop using AIR is an exercise best left to developers. I imagine that for web developers who have never programmed in C or any of the other traditional computer languages will find that AIR provides an easy road to building Desktop applications by using languages and technologies they already know. This is a very good thing, in my opinion.
For the rest of us, I think AIR applications are well worth checking out. They can be a mixed bag at times, especially because of the alpha nature of AIR on Linux, but the best of them are every bit as good as their traditional Desktop counterparts.