local Controller = {} local pushID --retrieve shared instance local manager = NotificationManager.getSharedInstance() function Controller.setPushID(theID) pushID = theID end function Controller.listenForPush() --if registration completed succesfully manager:addEventListener(Event.PUSH_REGISTRATION, function(e) --getting device token local token = e.deviceToken --sending token to your server local loader = UrlLoader.new("http://intoitgames.com") loader:addEventListener(Event.COMPLETE, function() --token succesfuly deliverd end) end) --if registration failed manager:addEventListener(Event.PUSH_REGISTRATION_ERROR, function(e) --device could not been registered now --try again later print(e.error) end) --try to register for push notifications manager:registerForPushNotifications(pushID) end return Controller