To do an ionic project to receive notifications (android) and I'm using the phonegap-plugin-push plugin.
var push = PushNotification.init({ "android": {"senderID": "860498722229", icon : "icon"},
"ios": {"alert": "true", "badge": "true", "sound": "true"}, "windows": {} } );
push.on('registration', function(data) {
console.log(data);
$rootScope.id = data.registrationId;
$rootScope.$apply();
});
push.on('notification', function(data) {
alert('Notificação acionada, agora deve-se implementar a navegação no app de acordo com os dados: ' + JSON.stringify(data));
});
push.on('error', function(e) {
alert('registration error: ' + e.message);
});
Yes, I have already executed the command that adds the plugin to the project 'ionic add phonegap-plugin-push'
Always return the 'PushNotification' error is not defined.