Created
January 9, 2013 22:57
-
-
Save donburks/4497778 to your computer and use it in GitHub Desktop.
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
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