Skip to main content
diskob46014489
Participant
September 26, 2016
Question

IOS 10 RemoteNotificationEvent.TOKEN not working

  • September 26, 2016
  • 2 replies
  • 558 views

I have tried the same app in IOS9 device and everything works as expected. Tried AIR SDK 19 and 23 with IOS 10 device and both gave same results, event is not fired.

This topic has been closed for replies.

2 replies

diskob46014489
Participant
September 28, 2016

Hi pravishtis,

Here is the code I tested with and device was iPad 4 with iOS 10.0.2

package

{

        import flash.display.Sprite;

        import flash.events.Event;

        import flash.events.RemoteNotificationEvent;

        import flash.events.StatusEvent;

        import flash.notifications.NotificationStyle;

        import flash.notifications.RemoteNotifier;

        import flash.notifications.RemoteNotifierSubscribeOptions;

        public class TestNotification extends Sprite {

                private var subscribeOptions : RemoteNotifierSubscribeOptions = new RemoteNotifierSubscribeOptions();

                private var preferredStyles : Vector.<String> = new Vector.<String>();

                private var remoteNot : RemoteNotifier = new RemoteNotifier();

                public function SecureSocketExample() {

                        this.addEventListener( Event.ADDED_TO_STAGE, addedToStageHandler );

                }

                private function addedToStageHandler ( event : Event ) : void {

                        preferredStyles.push(NotificationStyle.ALERT, NotificationStyle.SOUND );

                        subscribeOptions.notificationStyles= preferredStyles;

                        remoteNot.addEventListener(RemoteNotificationEvent.TOKEN, tokenHandler);

                        remoteNot.addEventListener(RemoteNotificationEvent.NOTIFICATION, notificationHandler);

                        remoteNot.addEventListener(StatusEvent.STATUS, statusHandler);

                        if(RemoteNotifier.supportedNotificationStyles.toString() != ' ') {

                                remoteNot.subscribe(subscribeOptions);

                        } else {

                                trace('Remote Notifications not supported on this Platform !');

                        }

                }

                public function notificationHandler(e:RemoteNotificationEvent) : void {

                }

                public function statusHandler(e:StatusEvent) : void {

                 }

                private function tokenHandler(e:RemoteNotificationEvent) : void {

                        trace(e.tokenId);

                }

        }

}

pravishtis
Adobe Employee
Adobe Employee
September 29, 2016

Hi,

Could you please help us with further information.

We tried running your code at our end and it woks fine. But we are using Push Notification enabled certificates in our application.

We have also added below tag in app.xml :

<Entitlements>

            <![CDATA[

  <key>aps-environment</key>

  <string>development</string>

            ]]>

        </Entitlements>

Please verify above two things at your end and refer to below blog for further information on Push Notifications with AIR applications:

Using push notifications in AIR iOS apps | Adobe Developer Connection

Please let us know if it helps you.

Thanks,

Adobe AIR Team

pravishtis
Adobe Employee
Adobe Employee
September 28, 2016

Hi,

Thanks for reporting the issue. We have tried reproducing this issue at our end and we are unable to reproduce it. Could you please share a sample project with us.

Thanks,

Pravishti
Adobe Air Team