Skip to content

Instantly share code, notes, and snippets.

@bitsmuggler
Last active August 29, 2015 14:25
Show Gist options
  • Save bitsmuggler/5837871d3800f99ad32b to your computer and use it in GitHub Desktop.
Save bitsmuggler/5837871d3800f99ad32b to your computer and use it in GitHub Desktop.
Register for Push-Notifications
var pushNotification;
// Abonnieren des Ereignisses 'deviceready'
document.addEventListener("deviceready", function(){
pushNotification = window.plugins.pushNotification;
...
});
// Registrierung beim entsprechenden Benachrichtigungsdienst
if ( device.platform === 'android' || device.platform === 'Android'){
pushNotification.register(
successHandler,
errorHandler,
{
"senderID":"<<replace_with_your_gcm_sender_id>>",
"ecb":"onNotification"
});
} else {
pushNotification.register(
tokenHandler,
errorHandler,
{
"badge":"true",
"sound":"true",
"alert":"true",
"ecb":"onNotificationAPN"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment