Skip to content

Instantly share code, notes, and snippets.

@donburks
Created January 9, 2013 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donburks/4497778 to your computer and use it in GitHub Desktop.
Save donburks/4497778 to your computer and use it in GitHub Desktop.
function on_reg(error, pushID) {
if (!error) {
alert("Reg Success: " + pushID)
}
}
function onDeviceReady() {
//UA push setup
push = window.pushNotification;
push.registerEvent('registration', on_reg);
// Reset Badge on resume
document.addEventListener("resume", function() {
push.resetBadge()
})
// Check if push is enabled
push.isPushEnabled(function(enabled) {
if (!enabled) {
push.enablePush();
push.registerForNotificationTypes(push.notificationType.sound | push.notificationType.alert);
}
});
push.getPushID(function(id) {
alert("PUSH ID: " + id); //Debug statement
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment