Last active
August 29, 2015 14:24
-
-
Save marchbold/6cc82e470686379ffd27 to your computer and use it in GitHub Desktop.
Setup the Parse application and register for notifications
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
| try | |
| { | |
| Core.init(); | |
| Parse.init( APP_KEY ); | |
| trace( "Parse Supported: " + Parse.isSupported ); | |
| trace( "Parse Version: " + Parse.service.version ); | |
| if (Parse.isSupported) | |
| { | |
| Parse.service.addEventListener( ParseEvent.NOTIFICATION, parse_notificationHandler ); | |
| Parse.service.addEventListener( ParseEvent.REGISTER_SUCCESS, parse_registerHandler ); | |
| Parse.service.addEventListener( ParseEvent.ERROR, parse_errorHandler ); | |
| // | |
| // The important setup call with your APPLICATION ID and CLIENT KEY from Parse | |
| Parse.service.setupApplication( "PARSE_APPLICATION_ID", "PARSE_CLIENT_KEY" ); | |
| } | |
| } | |
| catch (e:Error) | |
| { | |
| trace( "ERROR:" + e.message ); | |
| } | |
| ... | |
| private function parse_registerHandler( event:ParseEvent ):void | |
| { | |
| // Your application is now setup and registered for push notifications | |
| } | |
| private function parse_errorHandler( event:ParseEvent ):void | |
| { | |
| trace( "ERROR:: " + event.data ); | |
| } | |
| private function parse_notificationHandler( event:ParseEvent ):void | |
| { | |
| trace("Remote notification received! :: " + event.type ); | |
| trace( event.data ); | |
| } | |
| // com.distriqt.Parse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment