Intervalo telefónico: la llamada de registro de notificación push de GCM devuelve OK pero el dispositivo ni siquiera está conectado a Internet
he seguidoeste tutorial y tengo el siguiente código:
onDeviceReady ejecuto:
var pushNotification = window.plugins.pushNotification;
pushNotification.register(app.successHandler, app.errorHandler,{"senderID":"824841663931","ecb":"app.onNotificationGCM"});
Los manejadores:
// result contains any message sent from the plugin call
successHandler: function(result) {
alert('Callback Success! Result = '+result)
},
errorHandler:function(error) {
alert(error);
},
onNotificationGCM: function(e) {
switch( e.event )
{
case 'registered':
if ( e.regid.length > 0 )
{
console.log("Regid " + e.regid);
alert('registration id = '+e.regid);
localStorage.regid = e.regid
}
break;
case 'message':
// this is the actual push notification. its format depends on the data model from the push server
alert('message = '+e.message+' msgcnt = '+e.msgcnt);
break;
case 'error':
alert('GCM error = '+e.msg);
break;
default:
alert('An unknown GCM event has occurred');
break;
}
}
Este código funciona perfectamente si mi dispositivo está conectado a Internet la primera vez que abro la aplicación.
Si mi dispositivo no está conectado, se llama a successHandler con "OK" y nunca se llama a onNotificationGCM. ¿Esto es normal?
Esperaba que el registro fallara y llame al errorHandler o al onNotificationGCM con e.event = 'error' para poder posponer el registro, pero esto no está sucediendo.
Agradecería cualquier ayuda, gracias.