Using Adobe’s Notification Air Native Extension with Flash Professional for Android Devices


  • Show you how to use Adobe’s Notification ANE (Air Native Extension) with Flash Professional CS5.5 or later for output to Android devices
  • Provide you with all the necessary info and files for a sample project

Note: There is a much improved Notification ANE (based on Adobe’s version) posted by the awesome Juan Carlos Pazmiño.
It adds firedates. This is invaluable since notifications in iOS cannot be fired off while the app is in the background (since App’s are usually paused by iOS) without this feature. And it allows for custom notification audio (iOS only). Jaun also has a sample project that obviously makes better use of the firedate features than mine. So I would recommend using his ANE and sample files for use with iOS.

What you need

  • Flash Pro CS 5.5 or Later (I’m not positive, but I don’t think this will work with earlier versions of Flash)
  • Windows (this should work on a mac, of course but my tutorial uses windows)
  • Android Device (this is NOT working in the emulator and your device must have Adobe AIR 3.0 or later installed. Note: some devices are incompatible with AIR.)
  • AIR SDK 3.0 or later
  • JAVA (You can use the Java virtual machine from either the JRE or the JDK.)
  • Notification ANE (a small download)

Project Files Download

Project Files Zip
The Flash fla was created in CS 5.5.  (I tried to make a version saved as a CS 5 file for extra compatibility but the AIR ADT command line failed. It said that a newer version of Flash had been used to make the ANE swf. So I think the ANE was compiled using CS5.5.)
Also, remember that to use my fla file, you must follow Step 2 in Create your Flash Project (see below) to set the library path appropriate to your computer.


Thank goodness for Air Native Extension’s! I have an air app that needed to send notifications to Android and iOS, so Adobe’s Notification ANE is a lifesaver. Unfortunately, with some of the ANE’s (like this one), you cannot use Flash’s built-in ability to publish AIR app’s to your device. Until Flash Professional gets updated (hopefully in CS6), you must use command line tools to publish your app to your device if it uses this ANE. Bummer! Hopefully the steps below will make this process easier for you.

Adobe’s tutorial for notifications by Daniel Koestler is for Flash Builder.  My tutorial mostly uses Daniel’s code (thanks to Daniel!) but shifts it for use in Flash Pro.

Before ANE’s were released around Oct 2011, there was a great Android only solution from James Ward:

But for a single solution for Android and iOS you should go the Adobe ANE route. I have been hung up on this for months since the notification ANE does NOT work in the Android Emulator (at least for me). So I believed that the ANE was broken for months until I finally have been able to try this on a Droid 2 and it worked great!

P.S. One limitation of the ANE is that you cannot use custom audio for notifications. But you can turn off the default sound and play your own custom sound from within your app.Also, the app doesn’t allow for custom icons in the notification bar. It provides 6 possible icons. However, it is fairly easy to modify the ANE and insert your own icons in place of the default icons. If you keep the same names as the default icons, you will not need to rewrite any code.

P.S. Check out Brent Arnold’s great Vibration ANE tutorial if you are interested in good vibrations:

Outside Help

If you want more detail than I’m providing in this simple tutorial:

  1. Check out Adobe’s Notification ANE Page:
  2. Check out general info on how to use ANE’s:
  3. All the information you will need to build AIR apps:


  1. Download and unzip the lastest AIR SDK (currently 3.4):
  3. Download and install Java. You can use the Java virtual machine from either the JRE or the JDK (version 1.5 or newer). The Java JRE and the Java JDK are available at
  4. Download and unzip from:
  5. Download and unzip my project files (this is the same link as the one near the top of this blog):
    Project Files Zip

Overlay AIR SDK

Overlay AIR 3.0 or later in Flash Pro. Without doing this, Flash Pro is still using AIR 2.6 (CS5.5) or AIR 3.2 (CS6):

CS5.5 instructions:

CS6 instructions:

Prepare your files

These steps are taken care of already if you use my project files.

  1. Create your project folder.
  2. Inside your project folder create another folder called “notification“.
  3. Extract the notification.ane from inside the you downloaded to your “notification” folder.
  4. Make a copy of notification.ane and name it notification.swc so that you have  notification.ane and notification.swc files in your notification folder.

Set up  your path variable for CS5.5

***CS6 doesn’t need the command line so you can skip this (although I’ve found the command line builds APK’s faster than the tools inside Flash Pro).

  1. Set up your system’s path variable to point to your  AIR SDK command line tools. We’ll need the ADT (AIR debug tool) later to compile the apk files for android devices.
    In the Windows Start Menu Search Box, type: “path” and choose “edit environment variables for your account” (this works in Windows 7 for me). Choose the “Path Variable” and click “Edit”. Type or paste in the path to your downloaded AIR SDK’s bin directory at the end of the current path. Use a “;” (without any spaces) between any path’s that are already in the variable. For example, I pasted this at the end of my path variable:
    “;C:\Program Files (x86)\Adobe\Adobe_AIR_SDK_3.4\bin”
  2. Set up your system’s path variable to point to your  JAVA command line tools in the same manner as the previous step. The ADT tool uses JAVA for it’s inner workings. As an example, my path variable has this path pasted in:
    “;C:\Program Files\Java\jre7\bin;”

Here is some outside help on path variable’s if you are interested:

Install the AIR runtime on your device

You cannot run any AIR apps on your device without the runtime. On your device, go to the Android Market and install the latest AIR Runtime.

testANE Screen ShotCreate Your Flash Project

If you use my project files, you will need to do Step 2 below to fix the library path for your system.

You will create a simple flash project with 2 buttons. A notify button to send notifications and a cancel button that will stop the notifications. Also, the app has a timer function to send a notification 4 seconds after launch. That way you can set the app in the background immediately after launching it to see it send a notification from the background.

  1. Create a new Flash document with stage size to 480 x 480. Save the document as “testANE”.
  2. CS5.5 — Go to File>Actionscript Settings…; Choose the Library Path tab; Click the “Browse to SWC” button and browse to your notification.swc inside the notification folder. Do NOT hit the OK button yet.
    CS6 — Don’t add the SWC like in CS5.5. Add the ANE itself with the “Browse to ANE” button” browse to your notification.ane inside the notification folder. Do NOT hit the OK button yet.
  3. Make sure notification.swc (CS5.5) or notification.ane (CS6) is selected and click the “Set Linkage Options for a Library” button. In that dialog box, change the “Link Type” to External. (NOTE: The official directions say to use Link Type External. But I often got compile time errors concerning “NotificationEvent” with this setting. So I set Link Type to Merged Into Code and this worked for me.)
  4. CS5.5 — Go to File>Publish Settings…; Change the Player to AIR 2.6. or AIR for Android. If you have “overlayed” Air 3.4 with Flash properly from a previous step, this will actually produce an Air 3.4 package when you publish.
    CS6 — Change the Player to AIR 3.4. or AIR 3.4 for Android.
  5. Create an AIR signed certificate if you don’t already have one. It’s easy. Just go to File>Air Settings…; Go to the Signature Tab; and create a certificate. Name it “cert.p12” and create or move it into your project directory. Remember your password.
  6. Create a button on the stage. In the Properties Panel give it a name: “notify_btn”.
  7. Create a button on the stage. In the Properties Panel give it a name: “cancel_btn”.
  8. In the Properties Panel, set the document Class to “TestANE”.
  9. Open and erase all the code and paste this code in its place:
    package  {
    	import flash.display.MovieClip;
    	import flash.utils.Timer;
    	import flash.display.StageAlign;
    	import flash.display.StageScaleMode;
    	import com.adobe.ep.notifications.NotificationManager;
    	import com.adobe.ep.notifications.NotificationEvent;
    	import com.adobe.ep.notifications.Notification;
    	import com.adobe.ep.notifications.NotificationAlertPolicy;
    	import com.adobe.ep.notifications.NotificationEvent;
    	import com.adobe.ep.notifications.NotificationIconType;
    	public class TestANE extends MovieClip {
    		public var notificationManager:NotificationManager = new NotificationManager();;
    		public var n:Notification;
    		// You can set this value to anything you want (and use various values)
    		// You can then pass this value into the notification manager to cancel notifications of a specified type
    		public var timedNotification:Timer;
    		public function TestANE() {
    			// constructor code
    			//[SWF(height="800", width="480", frameRate="20", backgroundColor="#996666")];
    			//stage.align = StageAlign.TOP_LEFT;
    			//stage.scaleMode = StageScaleMode.NO_SCALE;
    			if ( notificationManager.isSupported )
    			    trace("The notification native extension is not supported.");
    		//setup notification manager
    		protected function createManager():void
    				//notificationManager = new NotificationManager();
    				n = new Notification();
    				// This action label appears in two places on iOS: on the action button of the notification dialog, and on the unlock slider when the device is locked.
    				n.actionLabel = "Open";// If unset, the iOS default will be used.
    				// Allows you to contorl whether an alert is dispathed with each notification, or just the first notification.
    				n.alertPolicy = NotificationAlertPolicy.EACH_NOTIFICATION;
    				// On Android, specifies whether the notification persists when the user taps it in the notification area
    				n.cancelOnSelect = true;
    				// On Android and iOS "...the app will be brought to the foreground if it was in the background or launched if it had been shutdown.
    				// On iOS, the way to perform the action of a notification manifests itself as a button
    				// on the notification dialog that appears when a notification is fired and different
    				// text on the unlock slider when the device is locked.
    				// On Android, the way to perform an action is not visible, it is performed by selecting
    				// the notification from the notification list (window shade)."
    				n.hasAction = true;
    				n.actionData = "customAction";
    				// Allows you to set the Android notification icon
    				n.iconType = NotificationIconType.ALERT;
    				// On both Android and iOS, lets you set a number on the icon or application badge
    				n.numberAnnotation = 0;
    				// On Android, "ongoing" notifications aren't cleared with the clear button
    				n.ongoing = false;
    				// Android and iOS
    				n.playSound = true;
    				// On Android, alerts (sound and vibration) until acknowledged
    				n.repeatAlertUntilAcknowledged = true;
    				// Only configurable on Android
    				n.vibrate = true;
    				n.tickerText = "TestANE Ticker Text";
    				n.title = "TestANE";
    				n.body = "Alarm Sent!";  
    				//user touches notification
    				//start timer to send notification
    				//setup buttons
    				notify_btn.addEventListener(MouseEvent.CLICK, notify_ClickHandler);
    				cancel_btn.addEventListener(MouseEvent.CLICK, cancelNotification_clickHandler);
    		//send notification
    		protected function notifyUser():void
    			// Dispatch the notification
    			// Note that the way popups work on iOS dictate that a pop-up window will only appear when the application is in the background.
    			// If the notification is dispatched and the app is running normally, you won't see a pop-up (but you will receive the event).
    			trace("air notification sent");
    		//notify button
    		public function notify_ClickHandler(event:MouseEvent):void{
    		//cancel button
    		protected function cancelNotification_clickHandler(event:MouseEvent):void
    			if ( this.notificationManager )
    				trace("Notification canceled.");
    				trace("No notifications have been dispatched.");
    		//user touches notification
    		private function onNotificationActionEvent(ne:NotificationEvent):void
    			trace("Notification action received. Type: " + ne.actionData);
    		private function onNotificationStatusEvent(ne:StatusEvent):void
    			trace("Notification status event received!");
    		//start timer notification
    		protected function startTimer():void{
    			timedNotification = new Timer(5000,1)
    			timedNotification.addEventListener(TimerEvent.TIMER, callNotifyUser);
    		//timer event
    		protected function callNotifyUser(event:TimerEvent):void{
    			timedNotification.removeEventListener(TimerEvent.TIMER, callNotifyUser);
  10. With your fla and as files saved, Publish the swf. I like to use Ctrl-Enter. When I do this, for some reason the swf doesn’t always appear in a test window. But it will create the swf in the project folder. Another mysterious thing, is that if I double click the swf, it will not run properly. The stage appears with the buttons missing. The ANE code is somehow incompatible with the desktop build of the swf I guess.
    Occasionally when I would use Ctrl-Enter, the movie would build properly with a working test window. I would see this message in the Flash output panel: “The notification native extension is not supported.” If you see that, you know the swf built properly. It is not supported on the desktop, but is supported on the mobile device.

Create your XML descriptor file

This is available in my project files already.

  1. In your project folder, create a new text document called “textANE-app.xml“.
  2. Paste the following XML code inside it and save it:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="">



      <uses-permission android:name="android.permission.VIBRATE"/>
         <service android:name="com.adobe.ep.localnotifications.LocalNotificationIntentService"/>


<supportedProfiles>mobileDevice </supportedProfiles>

Create your command line batch files (CS5.5)

***Again, you can skip command lines for CS6 if you want.

These are available in my project files already.

You can type command lines directly to the command line console. But it’s much faster to use a batch file so you don’t need to retype all this code if there are errors. Create and save these all in your project folder.

  1. Create a new text file and name it: “1createAPK.bat“.
    Add this to the text file:
    adt -package -target apk -storetype pkcs12 -keystore cert.p12 testANE.apk testANE-app.xml testANE.swf assets -extdir notification
    When you use this later, it will create a “testANE.apk” file using your cert.p12, swf, xml, and the notification.ane file found in the notification directory.
  2. Create a new text file and name it: “2installAPK.bat“.
    Add this to the text file:
    adt -installApp -platform android -package testANE.apk
    When you use this later, it will install “testANE.apk” on your device.
  3. Create a new text file and name it: “3launchAPK.bat“.
    Add this to the text file:
    adt -launchApp -platform android -appid testANE
    When you use this later, it will launch the app on your device.
  4. (optional) Create a new text file and name it: “4remoteDebugger.bat“.
    adb logcat air.testANE:I ActivityManager:I *:S
    When you use this later, it will allow you to see trace statements executed by your app to help you debug it.
  5.  Create a new text file and name it: “5uninstallAPK.bat“.
    Add this to the text file:
    adt -uninstallApp -platform android -appid testANE
    When you use this later, it will uninstall the app on your device.

Run your command line batch files (CS5.5)

***with CS6 just create and deploy the apk to your device within the AIR for Android Settings Dialog Box.

You can simply double click the bat files to run them. However, if there are any problems, the window will disappear quickly and you probably will not be able to read what the errors are! So its better to open the command line console and run the bat files from there.

  1. In the Windows Start Menu Search Box, type: “cmd” and choose “cmd.exe” (this works in Windows 7 for me). Navigate to your project directory. If you are new to the command line, here is one decent intro to navigating the console:
  2. Type “1” and hit the “Tab” key. The console will finish the name of the file in your directory that starts with “1”. So it will quickly type “1createAPK.bat” for you!
    Hit the enter key to execute the batch file. It will ask you for your password to your cert.p12 file. You should see a new textANE.apk file in your project folder if it worked.
  3. Connect your Android device via USB and type “2” and hit the “Tab” key in the command line console. You should see 2installAPK.bat in the command line. Hit the enter key to execute the batch file. If all is working (let us hope!), the app will be installed on the device.
  4. To launch your app either find it in the app menu of your device and run it. Or use 3launchAPK.bat to quickly launch it.
  5. If you want to debug your app and see output from the various trace statements, then run 4remoteDebugger.bat. The command line console will turn into a read only console listing error messages and trace statements, etc.
  6. If you later decide to make any changes to your app in flash and want to install a new version, you have to first uninstall the old version. You could just go to your device settings and find and uninstall the app but that is a slow process compared to using the command line. So in the console, type “4” and hit the “Tab” key in the command line console. You should see 5uninstallAPK.bat in the command line. Hit the enter key to execute the batch file. Et voila!

Good luck and bon voyage!

Visit me at


34 thoughts on “Using Adobe’s Notification Air Native Extension with Flash Professional for Android Devices

  1. Very nice tutorial, thank you!
    How can i export this sample for ios as .IPA file?

    i tried the following command without success:
    adt -package -target ipa-test -provisioning-profile devAppProfile.mobileprovision -storetype pkcs12 -keystore ZertifikateDev.p12 testANE.ipa testANE-app.xml testANE.swf -extdir notification

    would be nice if you could help me! 🙂

    1. i have never created anything for iOS. my app is ready to go and i just signed up for iOS development. so i will be exploring this in coming days. i will update this blog with new instructions if i can figure it out! but it will be a minimum of a couple of weeks before i’m there. if you figure it out before that, please come back and leave a comment telling us. thanks!

      1. I created an ipa file for iphone 4g and tested the app. I can launch the file and klick the “Notification ANE” button, but i dont get an alert like in android.
        Hope i made an error and there is a possibility to run on iphone..

      2. on this article i found an interesseting comment from jackub kovacs:

        he wrotes:
        “finally i got it work also on iOS … until Daniel will repare it (cause there is mistake in package) here is simple solution for those who want to use it : ”
        -> open notification.ane file with zip archiver
        -> go to /META-INF/ANE/iPhone-ARM/ …
        -> there are two compiled files “libADEPMobileNE.a” and “libADEPMobileNE.a.bak”
        -> well you have to switch those two files by renaming (somehow backup file is working correctly also is bigger in size so there is something wrong with actual one)
        -> close .ane file and now you can compile it for iOS …

        i tried that, but same result:
        the app starts and after i click the notification button, there is no effect.
        but interesting: i can see the push notification settings of my app in the iphone control center.. so i think ios is understanding the app type and function.. so maybe the problem is from the alert function and not from compiling.

  2. hmmm. things never seem to work like they are supposed to. please post back if you figure it out. i’ll be right there with you shortly. i agonized over the android version for 4 months (since it didn’t work in the emulator for me) and i don’t want to go through that with the iOS version too!

    1. Very interesting news: i realized, that the notification works at the iOS5-Notification-News Ticker. Aber there is no message box and no vibration/sound.

      OK i will contact you if i get more good news.

  3. cool! but i need a audio (or vibration) alert or my app is garbage. actually, on my app which employs this ANE, I get the audio alert by turning off the default sound (n.playSound = false) and playing the audio alert from within my app:

    var readyAlarmSC:SoundChannel;
    var readyAlarm:Sound = new Sound();
    readyAlarm.load(new URLRequest(“alert.mp3”));
    readyAlarmSC =,1);

    maybe that would work for you. according to the comments in my code, “n.vibration=true” only works for android. but how about the vibration ANE from adobe.
    sucks to have to implement that, but it should be fairly easy…

    1. Nice idea.. i’ll try the vibration extension!
      What about the sound channel, is the sound alert working out of the app?
      In my first tests the sounds play if the focus is on the app, but if i click the home button, the alerts goes off.

  4. i started on the iOS version of my app now but it is not working for me yet. i plan to update this blog with iOS info when i get it working (if!).
    painschen, have you been able to get it working on iOS?

  5. Thanks for the great tutorial. I saw Native Extensions being demonstrated at an Adobe event but it seemed liked there were a lot of hoops to jump through before I could manage to use this grate functionality. But thankfully you have documented all the hoops here, so thanks very much!

    All I need now is to find a Native Extension which allows me to launch another app!

    Thanks again.

  6. You said “However, it is fairly easy to modify the ANE and insert your own icons in place of the default icons. If you keep the same names as the default icons, you will not need to rewrite any code.”
    Could you explain ? Possible to do that without compiling again the ANE ??

    1. The ANE is just a .zip file renamed to .ane. You don’t have to worry about compiling or anything. I use winrar. I just open the ANE in winrar. I navigate to the folder containing the icons, and I drag and drop (from my desktop or other folder into the winrar window). If the name is the same, the old icon will be replaced with your new one. When you close winrar, the ANE still functions but has new icons inside it.

  7. hi i have tried your test ANE and the notification ANE tutorial posted by adobe and everything is working except for once the notification comes in, then you click on it int eh notifications slider clears the notification but doesn’t launch the app (is this correct or should it be doing this?) thanks for posting! cheers

      1. i just tried it doesn’t seem to work on Android (and never did by the sounds of things as it seems to be a iOS only version). did your version have this functionality? thanks

      2. yes. the ane i’ve posted here did work for me on android (also, the one that is improved for ios that i mentioned, should be identical for android purposes i believe). when i open the notification slider to see all the notifications, if i tap the notification, it is cleared and the app does become active for me. this is tested on android 2.3.
        you could test it on the free version of my app if you like:

      3. thanks for the info, will try your app to see how it functions. did you use flash cs6? (thats what I’ve used to export also linking the ane and not remaing to swc either, not using the adl so maybe thats the issue here – will try that maybe).

      4. as per this blog, i used flash cs5.5 with the command line. you should be able to use cs6 and link the ane (with no need to use the swc). i did use cs6 with juankpro’s modified ane without a problem. i assume it will work fine with this one. just haven’t tested it.

      5. i’m pretty sure i am exporting everything ok. as i am getting the notifications popping up. but the on click slider notification to launch the app never works which ever version i try and i have included the service android:name=” within the manifest too. so though that the ane might needed to be updated to support cs6 or something as i haven’t used adl yet, which i will try out. cheers

    1. hi. i’m going to add a notation to the top of this blog. there is a much better version of the notification ANE posted by the awesome Juan Carlos Pazmiño:
      it adds firedates for iOS (sadly no changes to android yet). this is invaluable since notifications in iOS cannot be fired off while the app is in the background without this feature.
      i’m glad i was able to help you!

      1. By the way I’m about to make an update to the Android version. I managed to make the notifications trigger at a future date. But the way the plugin is programmed right now doesn’t let for the notification to trigger repetitively at given intervals. For that one to work I need to re-write the code completely using a different approach. But because I’m pretty new to Android I might need to do a lot of trial and error for that.

  8. how to set multiple notifications.
    how to show a new notification on the notification bar when the old one still exist, is that possible?

    1. hey. sorry but i haven’t looked at this for a long time. this blog is about getting this to work, not the details of programming once it functions on the device. have you tried it yet? as i recall, i was having lots of problems because i always got duplicates so i had to figure out ways to avoid that in some cases. i will be getting back to the coding of this again eventually. i’ll let you know my techniques (but it may be too late for you.)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s