Skip to content

Instantly share code, notes, and snippets.

@marchbold
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save marchbold/6cc82e470686379ffd27 to your computer and use it in GitHub Desktop.

Select an option

Save marchbold/6cc82e470686379ffd27 to your computer and use it in GitHub Desktop.
Setup the Parse application and register for notifications
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