Last active
March 18, 2016 07:26
-
-
Save marchbold/d41ab7b384775cba6706 to your computer and use it in GitHub Desktop.
Registering for notifications using the Push Notifications ANE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PushNotifications.init( APP_KEY ); | |
if (PushNotifications.isSupported) | |
{ | |
PushNotifications.service.addEventListener( RegistrationEvent.REGISTERING, registeringHandler ); | |
PushNotifications.service.addEventListener( RegistrationEvent.REGISTER_SUCCESS, registerSuccessHandler ); | |
PushNotifications.service.addEventListener( RegistrationEvent.REGISTER_FAILED, registerFailedHandler ); | |
PushNotifications.service.addEventListener( RegistrationEvent.ERROR, errorHandler ); | |
PushNotifications.service.register(); | |
} | |
... | |
private function registeringHandler( event:RegistrationEvent ):void | |
{ | |
trace( "Registration started" ); | |
} | |
private function registerSuccessHandler( event:RegistrationEvent ):void | |
{ | |
trace( "Registration succeeded with ID: " + event.data ); | |
var deviceTokenOrRegistrationId:String = event.data; | |
} | |
private function registerFailedHandler( event:RegistrationEvent ):void | |
{ | |
trace( "Registration failed" ); | |
} | |
private function errorHandler( event:RegistrationEvent ):void | |
{ | |
trace( "Registration error: "+event.data ); | |
} | |
// com.distriqt.PushNotifications |
Hi,
Yes the extension works for both APNS and GCM.
Cheers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does the code works for both APNS and GCM?