document.addEventListener("deviceready", function(){
window.FirebasePlugin.getToken(function(token) {
// save this server-side and use it to push notifications to this device
// Get notified when a token is refreshed
window.FirebasePlugin.onTokenRefresh(function(token) {
// save this server-side and use it to push notifications to this device
console.log("Refresh to get new token: " + token);
// Get notified when the user opens a notification
window.FirebasePlugin.onMessageReceived(function(message) {
console.log("Message type: " + message.messageType);
if(message.messageType === "notification"){
alert("Notification message received");
alert("Tapped in " + message.tap);