I have all the plugins, but installed the following code:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
alert("ffdfdfd");
var pushNotification = window.plugins.pushNotification;
pushNotification.register(
successHandler,
errorHandler,
{
'senderID':'912521945079',
'ecb':'onNotificationGCM'
}
);
}
function successHandler(result){
console.log("RESULT "+result);
}
function errorHandler(error){
console.log("ERROR "+error);
}
function onNotificationGCM(e){
switch(e.event){
case 'registered':
if (e.regid.length > 0){
deviceRegistered(e.regid);
console.log("reg id "+e.regid);
alert("fff");
sessionServiceToken.set('token_device',e.regid);
}
break;
case 'message':
if (e.foreground){
alert('Mensaje');
}
break;
case 'error':
console.log("ERROOOOR");
break;
default:
alert("DEFAULT");
break;
}
}
I do not receive any type of message or error, do not understand why it does not work.