Push Notifications Support in iOS

[UPDATE: InvokeEventReason.NOTIFICATION added for accessing the notification payload when application was not running in the background. Latest AIR build containing these changes available here]

Push/Remote Notifications support for iOS platform has been made available in latest release of AIR 3.4. This blogpost will cover everything you need to do to get remote/push notifications working in your AIR application: subscribing for remote notifications, configuring your application in the iOS Provisioning Portal, sending notifications to Apple’s Push Notification Service (APNS), and handling them in your application. Another detailed article discussing Push Notifications Support in AIR can be found at http://www.adobe.com/devnet/air/articles/ios-push-notifications.html

Overview

Remote notifications, or server push or push notifications, describe a style of Internet-based communication where the request for a given notification is initiated by the publisher or central server. It contrasts with pull technology, where the request for the transmission of information is initiated by the receiver or client (device in our case). Push technology has the advantage over pull notifications that device battery and network bandwidth are saved when no new data is available.

Apple & Google have worked around these limitations with a push-based design. They have come up with the concept of an intermediate server, namely APNS (Apple Push Notifications Service) and Google C2DM (Cloud To Device Messaging), to handle all push notifications between the device and the third party servers. Rather than forcing your app to remain open and constantly querying for updates, device OS (iOS and Android) itself instead listens for updates and notifies your application as and when they arrive. The result is decreased processor, memory, and battery use. Additionally, instead of each app connecting to its own server, a single persistent connection is maintained between the device and the notification server (APN or C2DM). Complete details can be found here.

Basic Workflow for Push Notifications

  1. The application submits a request to the underlying OS to subscribe/register for push notifications. The application can choose the notification styles it wishes to subscribe for.
  2. The underlying OS then makes a secure connection to the APNS/C2DM, gets back a device token, and passes it to your application. [ Note that, this token is not the same as the device identifier.] This token is periodically refreshed. When the device registers for notifications again it will might a different device token. There are no guidelines on how soon the device token gets refreshed. It is therefore advisable to fetch the fresh device token on every launch of the application by subscribing for push notifications again and send it to the third party server.
  3. The application passes this token to the third party server.
  4. When the third party server wishes to send a push notification to a particular user, it grabs that user’s device token and sends it in a specially formatted payload to the APNS/C2DM.
  5. The APNS/C2DM forwards the message on to the given user’s device.

Basic Worflow of Push Notifications

Type of Push Notifications Supported

AIR on iOS supports following three styles of notification

  1. Alert: An alert box with a custom message in displayed in the remote notification.
  2. Badge: A badge is displayed on the application icon on receiving the notification. The badge icon is always cleared on the next launch of the application.
  3. Sound: A sound is played on receiving the remote notification.

Configure Your iOS App in the Provisioning Portal

Each iOS applications that uses the APN service must have a unique application ID that uniquely identifies itself. The reason being, the APN must be able to identify the specific device on which application is installed to which the push belongs, but wildcard identifiers allow you to build multiple apps with the same provisioning profile. Create a new App ID and configure it to enable push notifications service on this App ID. A detailed tutorial on how to create a new App ID can be found here.

Push Notification Server

This article covers the details on how to set up a push notification server that communicates with APNS to send notifications. A number of third party servers are also available that allow you to send notifications to your application. These can be used initially to test push notifications during development phase until you are ready with your push notification server. UrbanAirship is one of such third party server. More details on how to use Urban Airship can be found here. The sample code below demonstrates how to send the device token to the Urban Airship.

Code Snippet

import flash.notifications.*;
// empty Vector List is returned on platforms on which none of the notification styles is supported.
if ( RemoteNotifier.supportedNotificationStyles.length > 0)
{
	var preferredNotificationStyles:Vector.<String> = new Vector.<String>;

	preferredNotificationStyles.push(NotificationStyle.ALERT);
	preferredNotificationStyles.push(NotificationStyle.SOUND);
	preferredNotificationStyles.push(NotificationStyle.BADGE);

	var subscribeOptions:RemoteNotifierSubscribeOptions = new RemoteNotifierSubscribeOptions();
	subscribeOptions.notificationStyles = preferredNotificationStyles;

	rn = new RemoteNotifier();

	rn.addEventListener(RemoteNotificationEvent.TOKEN, sendDeviceTokenToServer);
	rn.addEventListener(RemoteNotificationEvent.NOTIFICATION, notificationReceivedByApp);
	rn.addEventListener(StatusEvent.STATUS, subscriptionFailureCallback);

        // calling subscribe method without any subscribe options automatically subscribes // for all notification styles supported on that platform
	rn.subscribe(subscribeOptions);
}
protected function subscriptionFailureCallback(event:StatusEvent):void
{
	trace("Received Status event for registrationFailure with code:" + event.code + " and level:" + event.level + "\n");
}
protected function sendDeviceTokenToServer(event:RemoteNotificationEvent):void
{
        trace("Received " + event.type + " with tokenString:" + event.tokenId + "\n");
        var urlRequest:URLRequest;
        var urlLoader:URLLoader = new URLLoader();
        var urlString:String = "https://go.urbanairship.com/api/device_tokens/" + event.tokenId;
        urlRequest = new URLRequest(urlString);
        urlRequest.authenticate = true;
        urlRequest.method = URLRequestMethod.PUT;
        URLRequestDefaults.setLoginCredentialsForHost("go.urbanairship.com","<Your App Key Here>","<Your App Secret Here>") ;
        urlLoader.load(urlRequest);
        urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);
        urlLoader.addEventListener(Event.COMPLETE, onComplete);
        urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onStatus);
}
protected function notificationReceivedByApp(event:RemoteNotificationEvent):void
{
	trace("Received RemoteNotificationEvent.RECEIVED\n");
	for (var i:String in event.data)
	{
		trace("Key:value pair " + i + ":" + event.data[i] + "\n");
	}
}

When is RemoteNotificationEvent.NOTIFICATION event disptached?

RemoteNotificationEvent.NOTIFICATION event is dispatched only in the following 2 cases:

  1. The application was in foreground when remote notification was received.
  2. The application was not in foreground when notification was received and as a result of the presented notification, the user taps the action button of the alert.

If the notification is delivered when the application isn’t running in the foreground, the system presents the notification, displaying an alert, badging an icon, perhaps playing a sound. And hence the event will not be dispatched. In other words, this event will NEVER be fired if application was in background(sleeping/dead).

For cases, when application is not running when notification was received and is launched on receiving the notification by pressing the launch button in the alert window or touching the banner alert, application is fired with InvokeEventReason set to InvokeEventReason.NOTIFICATION. The notification payload can be accessed in the first argument of the event object. You need to attach listener to InvokeEvent to check for the InvokeEventReason and arguments passed with it. The following code demonstrates the use case.

protected function onInvokeEvent(event:InvokeEvent):void
{
         trace(“Invokehandler called …. \n”);
         trace(“reason: “ + event.reason + “\n”);
        if( event.reason == InvokeEventReason.NOTIFICATION)
        {
               var payload:Object = Object(event.arguments[0]);
              for (var i:String in payload)
              {
                    trace(“Key:value pair “ + i + “:” + payload[i] + “\n”);
              }
              // TODO: DO THE NEEDFUL ON RECIEVING A NOTIFICATION HERE
       }
}

 

The above changes are only available from AIR 3.5 onwards and hence require swf-version set to 18 in Flash Builder Compiler settings.

How to handle RemoteNotificationEvent.TOKEN event?

RemoteNotificationEvent.TOKEN is dispatched upon successful subscription of push notifications by the application. The application now needs to send the App ID/ token received in event.data to his server via URL request. Since App ID is periodically refreshed by APNS, it is, therefore, advisable to subscribe for push notifications service on every launch of the application and send it to the third party server (depending on the cellular/wifi data availaibility). An application will not be able to receive push notifications once the APNS refreshes the App ID and the refreshed App ID is not available with the third party server sending push notifications to the application. For example:- if a user restores a backup to a device other than the one that the backup was created for, he/she must launch the application at least once to receive notifications again (assuming application subscribes for push notifications at every launch ).

Packaging the Application with Correct Entitlements

The application identifier of the AIR app must be same as the application identifier mentioned in the  provisioning profile.

<id>ApplicationIdentifierAsMentionedInMobileProvisioningCertificate</id>

Application requiring push notifications support also need to package their app with following Entitlements. These entitlements can be put in the Entitlements tag under InfoAdditions tag.

<iPhone>
	<Entitlements>
		<![CDATA[
			<key>get-task-allow</key>
			<true/>
			<key>aps-environment</key>
			<string>development</string>
			<key>keychain-access-groups</key>
			<array>
                         <string>KEYCHAIN_ACCESS_GROUP</string>
			</array>
 		]]>
	</Entitlements>
</iPhone>

For submitting the app to App Store with Push Notifications enabled, one needs to set the aps-environment tag mentioned above to production. The developer must use the provisioning profile with Push notifications enabled. One can cross check the Entitlements of the signed app using the following command.

codesign -d --entitlements - <YourAppName>.app

Also, remember to compile the swf with -swf-version=17 as an additional compiler argument.

Notification Payload Sample for iOS

Each push notification carries with it a payload. The payload specifies how users are to be alerted to the data waiting to be downloaded to the client application. The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit. Remember that delivery of notifications is “best effort” and is not guaranteed. For each notification, providers must compose a JSON dictionary object that strictly adheres to RFC 4627. This dictionary must contain another dictionary identified by the key aps. The aps dictionary contains one or more properties that specify the following actions:

  • An alert message to display to the user.
  • A number to badge the application icon with.
  • A sound to play.

The payload in the following example specifies that device should display an alert message with both Close and View buttons. It also request that the application icon be badged with 9 and that a bundled alert sound be played when the notification is delivered.

{
    "aps" : {
        "alert" : "You have received new emails.",
        "badge" : 9,
        "sound" : "mailAlert.aiff"
    },
}

How to Send Localized Remote Notifications to your Application?

The client application can store in its bundle the alert message strings translated for each localization it supports. The provider specifies the loc-key and loc-args properties in the aps dictionary of the notification payload. When the device receives the notification, it uses the aps dictionary properties to find and format the string localized for the current language which it then displays to the user. Localized strings must reside in the file called Localizable.strings in the appropriate <language>.lproj folder. Each entry in this file has a key and a localized string value, the string can have format specifiers for the substitution of variables values.When an application asks for a particular string, it gets the resource that is localized for the language currently selected by the user.

In order to receive localized remote notifications, an AIR application must have localized key value pairs in Localizable.strings file in the <language>/lproj folder inside the ipa. To add the Localizable.strings in the ipa, the developer just needs to mention the requested languages in the <supportedLanguages> tag in the application descriptor and add the respective  <language>.lproj folder in the adt command as follows:

<supportedLanguages>en es fr</supportedLanguages>
adt -package -target ipa-app-store -provisioning-profile <path to mobileprovision certificate> -storetype pkcs12 -keystore <path to Certificates.p12> -storepass <password> <ipa name> app.xml sample.swf en.lproj es.lproj fr.lproj

Please note that lproj folder need to present in the current directory to let the adt merge the files in appropriate lproj folder. If the lproj folder is given as a/b/c/en.lproj then adt adds this as a/b/c/en.lproj and hence localized key value pairs wont be accessible to the application.

58 Responses to Push Notifications Support in iOS

  1. erick says:

    Thanks alot for this exhaustive explanation.
    Just a little “typo” in the var urlString » https://go.urbanairship.com/… ( not ‘urbanairhsip’ )
    And maybe it can be useful to remind somewhere that you need to compile with -swf-version set to 17.
    Anyway, I’m sure that now i’m not so far now from my first push notification.
    Thx

  2. Pete Couture says:

    The coding notes contained a few mistakes. I listed them here: http://forums.adobe.com/thread/1039052?tstart=0

  3. martin says:

    Push notifications work BUT I cant seem to get registeration to work when the app launches. Shouldn’t the app register for push notifications every time when I open to app? For some reason sendDeviceTokenToServer is not called when I launch the app. How to register for push notifications again after the first time app was started?

    • Varun Bhatia says:

      App does not register for push notifications on its own at every launch. You should subscribe for push notifications at every launch by putting the registration code in Activate event handler.

  4. Yohai says:

    Hi. Can you give some more info about the badge behavior?
    Is there a way to manually update the badge when the app is foreground.
    When the badge is being cleared? is there a way to manually clear it?

    Thanks

    • Varun Bhatia says:

      Badge number cannot be controlled in the AIR app since local notifications are till date not supported in AIR. Badge notifications are always cleared on the next launch of the application. Since there are cleared by default, you dont need to manually clear it.

  5. Aha, so too it seemed to me.

    P.S. Please review icons

  6. MIke says:

    Hi and thanks for the explanation and code. I’m trying to run some of the code and I’m getting the error : Error #1014: Class flash.notifications::RemoteNotifier could not be found.

    which is telling me that it can find the lib. not sure whats missing. I have AIR 3.4 layer over the SDK 4.6 and using flash builder 4.6

    any help would be great.

    • Varun Bhatia says:

      Are you missing -swf-version=17 tag in compiler options? Also verify the namespace in the application descriptor must be 3.4.

      • MIke says:

        thanks for the reply

        in my compiler I have set the command to -swf-version=17
        I have downloaded the 11.4 global-player swc and placed it in the frameworks\libs\player\11.4 folder but still get the error .

        the descriptor is set to 3.4 . so I’m not sure what else to do really stuck …

  7. Dennis says:

    I have set it up so that everything seems in order – i get no errors during compile or at runtime and i can see that the rn.subscribe(subscribeOptions); is called. However – none of the listeners (neither StatusEvent.STATUS nor RemoteNotificationEvent.TOKEN) are returned after this request has been made. I am compiling a developer version of the app and the app is configured for push in developer mode.

    Any pointers as to what i should check up on to get this working?

    • Varun Bhatia says:

      Since you are not getting the TOKEN event, that means that either you are not using the correct mobile provisioning profile or you are not using the correct entitlements. If you are using a mac, you can check the console tab of organizer for any error. Also, check the notification settings of the device. They may be totally off in General Settings. If you are using the correct mobile provisioning profile and entitlements, you see your app listed there.

      • Dennis says:

        But shouldn’t i then get the StatusEvent.STATUS – or some other kind of exeption.

        • Varun Bhatia says:

          AIR Runtime dispatches the status event as soon as we get some subscription failure exception from iOS. But for some cases, we dont get an exception callback and hence status event cant be fired.

      • Dennis says:

        Hi Varun
        I am compiling in win7 so cant use organizer. However i can confirm that the app is listed in the settings -> notifications. This leads me to conclude that the Provisioning profile and the entitlements (which i have tripple checked) are set up correctly and that the root of the problem is something else.

        but what?
        Do you have any pointers?

        • Varun Bhatia says:

          If you app is listed in settings->notifications, are notifications enabled for the app? If they are disabled in settings, subscription wont work. Try enabling them and then subscribe again. Hopefully you will receive token event now.

          • Dennis says:

            All three types of notifications are enabled for the app in settings -> notifications. But still the remoteNotifier.subscribe(); call does not result in any of the two callbacks being called:

            remoteNotifier.addEventListener(RemoteNotificationEvent.TOKEN, tokenRecieved);
            remoteNotifier.addEventListener(StatusEvent.STATUS, subscriptionFailureCallback);

            As i mentioned somwhere else the two events do not seem to be associated with the remoteNotifier object. (at least not auto-complete wise) – could this be the explanation?

      • Dennis says:

        I have noticed a strange behaviour in Flashdevelop.

        When i enter in:
        var remoteNotifier:RemoteNotifier = new RemoteNotifier();
        remoteNotifier.addEventListener(XXX

        The auto-complete only allows me to choose between Event.ACTIVATE og Event.DEACTIVATE – not RemoteNotificationEvent.TOKEN or StatusEvent.STATUS – even though both classes are imported and can be instantiated as expected.

        Normaly all relevant events are listed.

        Could this be at the core of the issue.

      • Dennis says:

        Seeing Chris’ response below i should maybe specify that i am using flash CS5.5 to compile the swf and then the newest flex ADT to compile the ipa from this swf.

    • Chris says:

      I am having the exact same problem. Everything compiles, and tracing the supportedNotificationStyles property outputs “alert,sound,badges” as expected.

      I have used an identical certificate and .mobileprovision file to generate a token using FlashDevelop, but trying to get this working in an existing app in Flash CS6 is giving me nothing.

      Also, where exactly do you set the compiler option “-swf-version=17″? Do you have to compile manually from the command line to be able to edit these options, or are they somewhere else?

      • Varun Bhatia says:

        You need to set -swf-version=17 in Project->Properties->Actionscript Compiler. Hopefully this will make things work fr you.

        • Chris says:

          Appreciate the response Varun. I should have specified that I am using Flash CS6. I’m not aware of a project->properties menu anywhere, is that a Flash Builder thing? Is there any way to do the equivalent in CS6?

          • Varun Bhatia says:

            In Flash Pro CS6, go to Help > “Manager AIR SDKs”, point it to 3.4 beta AIR SDK, and now compile your project using AIR 3.4 Publishing option.
            It should create your swf with 17 version, also ensure namespace in app descriptor is 3.4

          • Chris says:

            Ok that’s what I’ve been doing. I’m using Air 3.4.0.2540 for iOS and experiencing the same absence of either success or error events being called, just as Dennis is seeing above.

          • Ramy Assaf says:

            I have successfully added the compiler argument swf-version=18 in flash CS6 to load swf files at runtime in my iphone app
            I have added the below in the first layer of the fla before all code.

            [swf-version=18]

            import flash.display.MovieClip;
            import flash.net.URLRequest;
            import flash.display.Loader;
            .
            .
            .

  8. All is working for me — I can send push notifications to both production and debug builds. Got all the certs working, tweaked the entitlements in the app descriptor, etc.

    Push notifications arrive just fine… but :-)

    I was never prompted by iOS with the usual “this app would like to send you push notifications. would you like to allow this?” prompt. It just “worked” without the user ever authorizing the push notifications — how is this even possible, given the way AIR interacts with iOS?

    • Dennis says:

      If you already accepted push for that app on your device – you wont be propted again.
      This is one of the harder parts of testing push in ios.
      I think you have three options:
      1. uninstall the app and have it uninstalled for at least 24 hours – then try again
      2. Reset the device and try again (this might not be an option if you develop on your personal device)
      3. Use different app-ids each time you test.

  9. Norel says:

    Hi,
    I’m really excited to test iOS push notifications, so thanks.
    When I try to use them however, I always get this error :

    [Fault] exception, information=VerifyError: Error #1014: La classe flash.notifications::RemoteNotifier est introuvable.

    -> in English : Error #1014: Class flash.notifications::RemoteNotifier could not be found.

    This is my setup :
    - FlashDevelop 4.1.0
    - Latest Flek SDK 4.6.0 with Air 3.4
    - Compiling for Air 3.4
    - Air version in app XML is set to 3.4
    - Additional compiler options : -swf-version=17 -target-player=11.4
    - Standalone Flash Player 11.4

    If you could help me it would be awesome :)
    I spent a long time looking for a solution but can’t matter where the problem is !

    • Varun Bhatia says:

      It seems you need to overlay the sdk again.

      • Norel says:

        Ok, I’m just plain stupid.
        I have the error when I test the SWF on my desktop, but of course the standalone Flash Player doesn’t know anything about RemoteNotifier…
        When I test the app on iOS it works fine.

        Thank you Varun :)

  10. Ramy Assaf says:

    I’m using Flash Professional CS6 and Air 3.5.0.1060

    The push is working and RemoteNotificationEvent.NOTIFICATION is firing.

    But InvokeEvent.INVOKE is not firing at all, below is the event handler and function

    NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvokeEvent);
    function onInvokeEvent(event:InvokeEvent):void {
    trace(“Invokehandler called …. \n”);
    trace(“reason: ” + event.reason + “\n”);
    if (event.reason == InvokeEventReason.NOTIFICATION) {
    var payload:Object = Object(event.arguments[0]);
    for (var i:String in payload) {
    trace(“Key:value pair ” + i + “:” + payload[i] + “\n”);
    }
    // TODO: DO THE NEEDFUL ON RECIEVING A NOTIFICATION HERE
    }
    }

    I have added this to the Fla file [swf-version=18]
    I have used the swf-version=18 before (loading multiple swf files on ios) and it worked

    I have spent a lot time to get the InvokeEvent.INVOKE fire but with no success,

    Any help will be appreciated.

    • Varun Bhatia says:

      InvokeEvent is fired with InvokeEventReason.NOTIFICATION only when application was not running (even in background) when notification was received and application was fired by tapping the notification. InvokeEvent wont be fired when notification is received when application is running in foreground or background.

      • Ramy Assaf says:

        Exactly,

        I’m testing it after closing the app completly (double-clicking the square button and closing it), then sending push notification to the app, but when i tap the notification the InvokeEvent is not fired.

        I think the problem is from Flash CS6 & swf-version=18 (but it worked with loading multiple swf on runtime in air for ios)
        I have added [swf-version=18] in the fla layer before all my code, plz check below

        [swf-version=18]

        import flash.display.Sprite;

        import flash.events.*;
        import flash.events.Event;
        import flash.events.RemoteNotificationEvent;
        import flash.events.StatusEvent;
        import flash.net.*;
        import flash.notifications.NotificationStyle;
        import flash.notifications.RemoteNotifier;
        import flash.notifications.RemoteNotifierSubscribeOptions;

        import flash.events.InvokeEvent;
        import flash.desktop.InvokeEventReason;
        import flash.desktop.NativeApplication;
        .
        .
        .

  11. Ramy Assaf says:

    I need to change the swf version to 18 in Flash CS6 with no success at all.
    I can’t believe that the “compiler argument” is not Available in Flash Professional yet.

    Adobe please update like you updated to manage air SDK in Flash
    We should have something like: manage swf version in Flash pro

    thanks

    • Varun Bhatia says:

      In Flash Professional, explicit switch for swf version is not required.
      It compile the swf with a version associated with sdk . So if your app is using AIR 3.6, the swf version should be 19.

  12. Varun Bhatia says:

    Can you please send a sample project in which Invoke Event is never fired with AIR 3.5. I would also request you to try AIR 3.6 labs release available at http://labs.adobe.com/technologies/flashruntimes/air/. You can send me the zipped project file at varun.bhatia[at]adobe[dot]com

  13. Pingback: AIR 3.4 : quelles nouveautés pour le mobile ? |

  14. Anne Y says:

    Hi Varun
    Thanks so much for this post!
    I’m facing an issue with the following, if I click “Don’t Allow” when prompted if I want to allow for push notifications for my app. I am not receiving the RemoteNotificationEvent.TOKEN and my app hangs at the Loading screen.

    Is this normal/expected?

    I find that if I then go to my Settings, allow notifications AND redisable it again, I can launch my app without a problem i.e I get a TOKEN back.

    • Varun Bhatia says:

      You will definitely not get the RemoteNotificationEvent.Token when user clicks the Dont Allow Button. This way Apple allows the end users to decide whether they really want to receive push notifications or not. You should not wait for the Token event to load your first screen. Load the screen and wait for TokenEvent. If it comes, then send the token received to your APNS server.

  15. Sixto says:

    Hi all,
    I’m trying to send push notifications following the tutorial here http://www.adobe.com/devnet/air/articles/ios-push-notifications.html. But until now I have not achieved to send notifications to my Ipad.

    I created an account in Urban Airship but when I want to send a “Test Push” shows me the following message “Sorry, your application is not currently set up for push notifications due to the Following error: That Apple rejected certificate”.

    Someone could help me please?

    • Varun Bhatia says:

      You are not using the right .p12 certificate at urban airship. Maybe its expired and you need to create a new one.

  16. w991411 says:

    hi:
    When I run the app ,sendDeviceTokenToServer and subscriptionFailureCallback methods are not fired, What I can do?

  17. comeOnPlease666 says:

    thaks for the tutorial. everything works fine, besides ONE thing. I just dont seem to get the
    event.reason == InvokeEventReason.NOTIFICATION
    working. I keep getting the following error:
    1119: Access of possibly undefined property NOTIFICATION through a reference with static type Class.
    I’ve imported the flash.desktop.NativeApplication, flash.desktop.InvokeEventReason and flash.events.InvokeEvent classis. and everything seems to work fine except i just cant wrap my head around WHY AIR of iOS doesnt seem to support NOTIFICATION whilst it supports LOGIN and STANDARD. I know that the NOTIFICATION parameter works only on iOS however I cant even publish the ipa fail. Or is there a way to publish the file without the error stopping it on mac and then run it on ios device (standard and login parameters seem to work just fine on my ios devices).

    • Varun Bhatia says:

      What is the version of AIR SDK that you are using? The only reason for error 1119 can be wrong AIR version or swf version. Kindly note that InvokeEventReason.NOTIFICATION is only supported from AIR 3.5 onwards.

  18. comeOnPlease666 says:

    thanks for the quick reply. Im using the newest updated version of flash cs6 and air 3.7. When I write code the code hint feature also ONLY hints that there can be either STANDARD or LOGIN specified for InvokeEventReason. Are u sure that the NOTIFICATION option is allowed?

    everything else you had in this tutorial is working perfectly. my goal is just to get the app to open on a certain subcat when the user enters it by pushing Launch on a iOS push notification.

  19. Shashank Vangari says:

    The Push notification seems to be working fine for me ,but I have a requirement for accessing the alert message within the application .How do I access the JSON payload from event.data , if I trace event.data.aps I get
    {
    alert = “text”;
    badge = 1;
    }

    which is a string, I can manually find the text but is there any other way to get this

    Thanks
    Shashank