Last active
August 29, 2015 14:25
-
-
Save bitsmuggler/5837871d3800f99ad32b to your computer and use it in GitHub Desktop.
Register for Push-Notifications
This file contains 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
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