Tag Archives: air2

Using Growl in AIR applications with AIR 2 NativeProcess

The AIR2 release is just around the corner and one of my favorite new features is the ability to use native scripts. As I’ve already demonstrated earlier, this is extremely powerful and here’s another good example.

From the moment AIR was released, a lot of developers were asking for Growl support to add toast style notifications. Up until now, there hasn’t really been an easy and flexible solution so most developers opted to build their own notifications. I really like Growl and the fact that you as a user have total control over the look and feel. I use the Mono style created by Christopher Lobay. It’s probably the sexiest toast style notification I’ve ever used.

With AIR 2 you can now call Growl right from within your application. I actually call the Growlnotify command-line tool, which comes as an extra in the Growl download. Most people probably don’t install these extras but that’s no problem. I can bundle the command-line tool as part of my application and call it directly from my applicationDirectory.

So… How does this work? It’s actually extremely easy… The first thing you do is set up a new File object that points to the Growlnotify tool.

var file:File = File.applicationDirectory;
file = file.resolvePath("growlnotify");

As I am going to bundle growlnotify with my application it will just be installed as part of the app and thus resides in applicationDirectory.

The next thing I have to do is set up a NativeProcessStartupInfo object. That’s where I’ll store the basic information that is used to start our NativeProcess.

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var processArgs:Vector.<String> = new Vector.<String>();
processArgs[0] = "-n";
processArgs[1] = "My AIR application";
processArgs[2] = "-p";
processArgs[3] = "0";
processArgs[4] = "-t";
processArgs[5] = "Your Growl title";
processArgs[6] = "-m";
processArgs[7] = "Your Growl message";
processArgs[8] = "-a";
processArgs[9] = "Adobe AIR Application Installer";
nativeProcessStartupInfo.arguments = processArgs;
nativeProcessStartupInfo.executable = file;

In this case, I’m also adding a bunch of arguments in my NativeProcessStartupInfo object. These arguments will be passed on to the growlnotify command-line tool. In this example, I’m setting up the name of my application, the notification priority, the title and message of my notification and I’m also telling it to use the icon associated with the Adobe AIR Application Installer. (Check out the Growlnotify docs for more info on these settings)

Next and last step is to actually call the native script.

process = new NativeProcess();
process.start(nativeProcessStartupInfo);

This code above will result in this Growl notification:

The only downside of using native scripts is that you’ll have to package your application specifically for the operating system you wrote your native script for. So in this case, I’d have to package it as a .DMG file since Growl only exists on OS X. That said, I really wouldn’t mind an OS X version of TweetDeck that allows me to use Growl instead of their custom notifications…

I really can’t wait to see what you guys are going to build with AIR 2! You can already start today! Check out Adobe Labs for more information!

Read full storyComments { 24 }

Happy 2nd birthday, Adobe AIR!

Aaah… They grow up so fast… Adobe AIR is 2 years old today. With AIR 2 now coming to mobile devices like Android devices and Apple’s phones it’s clear that AIR has a bright future ahead.

The AIR 2 release is just around the corner but you can already start building and testing your apps with the public beta available on Adobe Labs.

If you’re interested in learning about the new features AIR 2 has to offer, check out my presentation slides from FITC and the demo files that go with it. Also check out Tour De Flex for more code samples.

I can’t wait to see what you guys are going to build with AIR 2 and its new capabilities!

Photo by Lee Turner.

Read full storyComments { 10 }

“What’s new in FP10.1 and AIR2″ slides and source files

Earlier this week I did a presentation on all things new in Flash Player 10.1 and AIR 2 at FITC in Amsterdam. While it’s impossible to cover everything in an hour, it should give you a good idea on some of the new features.

You can download the sources as well. I’ve included both the Flex project files (.FXP) as well as the mxml files for those of you that are not yet on Flash Builder 4. Remember that you must have the AIR 2 SDK installed to use these examples.

Flash Player 10.1 Beta 3 was released earlier this week. Make sure you download the latest beta and test your content!

Read full storyComments { 17 }

Package Assistant for AIR 2 update

Just before the holidays, I released an alpha version of my AIR 2 Package Assistant application. As many of you know, AIR 2 allows you to build native installers. The only downside is that you have to use the command line in order to package these native installers.

I have just narrowed down the possible solution for the only reported problem. Some of you got an “Invalid input” error message and the packaging failed. I think this may be caused by forgetting to include the icons you use for the app. You have to include these in the final step where you add any additional files to the package.

I also updated the application so it now works with the AIR 2 Beta 2 runtime, which is available on Adobe Labs.

The Package Assistant application should still be considered in alpha phase. If you don’t mind testing alpha builds, go ahead and download the updated application. (Don’t forget to read these notes.)

If you find any other bugs or if adding the icons did not resolve the “invalid input” error message, feel free to leave a comment or email me directly.

Read full storyComments { 6 }

AIR 2 Package Assistant “public alpha”

I already sneaked this application last week but in case you missed that: I am building an application that makes it easier to package native installers for AIR 2.0. Instead of having to fiddle around with the command line to create installers, this wizard style application makes it very easy and straightforward.

Now before you go and install this application, there are a couple of things you should know.

  1. This is an early version of the application. It may not do what you thought it would do and it may even explode ;-). If that is the case, please let me know. I’m releasing it now to get some feedback and to improve version 2 ;-) The application should be considered alpha quality.
  2. It is currently OSX only. I ran in to a little snag with the Windows version but will try to get around that ASAP.
  3. It currently only supports PKCS12 code signing certificates.
  4. It’s not yet very user friendly if you make a mistake… If you for instance mess up your cert passcode, you’ll have to start over again. I’m also not saving the path to ADT.. These things are “on the list”.
  5. Additional files are supported but are always relative to the folder that holds the main SWF… This is one that needs a lot of testing. If your setup does not work, please let me know.
  6. If you have feature requests or you find a bug or something weird, please let me know. Just leave a comment to this post, send me an email or use the contact form on my blog.
  7. Did I already mention that this should be considered alpha quality?
  8. I think it’s fairly obvious but just in case: This application requires the AIR 2.0 runtime.

So… You’re still here. That must mean that you’re a geek like me and you don’t mind testing early builds of applications ;-). Good… Go ahead and download the application.

Read full storyComments { 18 }

Introducing: Package Assistant (AIR 2 package utility built with AIR 2)

Two of the most requested features for AIR were the ability to create native installers and to launch/talk to native applications. Among other new features, AIR 2 allows you to do that. To build these native installers you have to use the command line compiler.

A while back I was thinking if it would be possible to write an AIR application that would talk to ADT (the command line compiler) and that would make it easier to compile a native installer. And here it is… Well… It’s not quite finished yet but it’s very close. I just couldn’t wait sharing this screencap with you guys because I think it’s a great example of how powerful AIR has become.

The wizard style application allows you to easily identify the files it needs and after just 4 steps you simply
hit the compile button. A lot easier than fiddling around with the command line ;-)

I should have this finished before the holidays so stay tuned!

Read full storyComments { 17 }

Raising the bar… again: FP10.1 & AIR2 betas on Labs

Wohooow… It’s always great to wake up to new toys to play with! Flash Player 10.1 and AIR2.0 are now available on Adobe Labs.

This is a very exciting release for Adobe. Not only is it the first time that we sim-ship Flash Player and AIR for all 3 major operating systems (Mac, Windows & Linux), Flash Player 10.1 is also the first runtime release of the Open Screen Project. While we’re only releasing the beta version of Flash Player 10.1 for the desktop we do plan to roll out additional betas prior to the release with more features, performance improvements, new tooling options and support for mobile platforms. I’ve been lucky enough to play with some smart phones that already have Flash Player 10.1 and I am absolutely amazed to see the performance on these devices. It’s also great to finally have FP10 in the browser on a mobile device. It’s great to see you can now have the full web in your mobile browser!

We’ve already talked about and demoed some of the new features at MAX. Check out the feature page on Labs for a complete list of new features in Flash Player 10.1 and Christian Cantrell’s blog for a comprehensive list of new features in AIR. Christian also has a bunch of code samples on his blog demonstrating the new features. Also check out Adobe TV for more demos and tutorials.

Don’t forget… These are pre-release BETA releases. While the Flash Player and AIR teams do their very best to maintain backward compatibility, things may break. And that is exactly why we do these public betas. If you do come across an application that doesn’t work, make sure you tell us about it!

I can’t wait to see what you guys are going to build with this new set of building blocks… Flash on!

Read full storyComments { 18 }