Created
May 28, 2014 13:39
-
-
Save joshjensen/90d0cb4edadb92ef57bb to your computer and use it in GitHub Desktop.
Sample Push Handler.
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
CloudPush.retrieveDeviceToken({ | |
success: function(_data) { | |
Ti.API.info("ACS.init @success"); | |
exports.deviceToken = _data.deviceToken; | |
Ti.App.Properties.setString("PUSH_DEVICETOKEN", _data.deviceToken); | |
CloudPush.addEventListener('callback', function (evt) { | |
if (appActive) { | |
exports.pushRecieved(evt); | |
} else { | |
var activeInterval = setInterval(function() { | |
if (appActive) { | |
exports.pushRecieved(evt); | |
clearInterval(activeInterval); | |
} | |
}, 500); | |
} | |
Ti.API.info(JSON.stringify(evt)); | |
}); | |
}, | |
error: function(_data) { | |
Ti.API.info("ACS.init @error"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment