Skip to content

Instantly share code, notes, and snippets.

@jcesarmobile
Created January 25, 2016 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcesarmobile/04fa586057ac79303e88 to your computer and use it in GitHub Desktop.
Save jcesarmobile/04fa586057ac79303e88 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<title>Tutorial Push</title>
<script>
document.addEventListener("deviceready", deviceReady, false);
function deviceReady() {
var push = PushNotification.init({
android: {
senderID: "455908641475"
},
ios: {
alert: "true",
badge: "true",
sound: "true"
}
});
push.on('registration', function(data) {
document.getElementById("idDispositivo").innerHTML = data.registrationId;
});
push.on('notification', function(data) {
var ul = document.getElementById("notificacionesPush");
var li = document.createElement("li");
li.appendChild(document.createTextNode(data.title+": "+data.message));
ul.appendChild(li);
});
}
</script>
</head>
<body>
<div class="app">
<h1>Tutorial Push</h1>
<p id="idDispositivo"></p>
<ul id="notificacionesPush">
</ul>
</div>
<script type="text/javascript" src="cordova.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment