ionic push notifcation error

1

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.

    
asked by anonymous 10.02.2016 / 23:56

1 answer

2

I recommend the OneSignal, the site has an example of how to implement, it follows exactly what is written only by changing the Key. It is very reliable besides being free.

link

    
12.02.2016 / 11:05