Forked from jcesarmobile/Ejemplo de uso del plugin push
Created
April 17, 2017 21:29
-
-
Save TemoPacheco/1f10e4109bfd9594cdc7dc1bb62f907c to your computer and use it in GitHub Desktop.
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
<!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