4

I am having problems with my project.

I have an Ionic Project and I'm using phonegap-plugin-push to send push notifications. On Android works well, but on iOS doesn't work. Do not appears the alert asking if I want to receive notifications and the Registration Event isn't executed.

What is wrong?

Thanks in advance.

Apple Application Services

Here is my code:

document.addEventListener('deviceready', function() {
    console.log('>>>>>> DEVICE READY <<<<<<');
    handleNotificationReady();
});

function handleNotificationReady(){
    console.log('>>>> HandleNotificationReady <<<<');
    var pushNotification;

    if (device.platform == 'Android') {
        console.log('>>> Android, nice to meet you!');
        pushNotification = PushNotification.init({
            android: {
                senderID: '6610***',
                icon: 'icon'
            }
        });
    } else if (device.platform == 'iOS') {
        console.log('>>> iOS, nice to meet you!');
        pushNotification = PushNotification.init({
            ios: {
                alert: 'true',
                badge: 'true',
                sound: 'true'
            }
        });
    }

    pushNotification.on('registration', function(data) {
        console.log('>>>> REGISTRATION <<<<');
        console.log(data.registrationId);
    });

    pushNotification.on('notification', function(data) {
        console.log('>>>> NOTIFICATION <<<<');
        console.log(data);
    });

    pushNotification.on('error', function(err) {
        console.log('>>>> ERROR <<<<');
        console.log(err);
    });
}

Here is my console:

`>>>>>> DEVICE READY <<<<<<
>>>> HandleNotificationReady <<<<
>>> iOS, nice to meet you!`
eliangela
  • 253
  • 2
  • 5
  • 21

1 Answers1

3

I understand your problem.

Did you try to remove the push-plugin and add it again. And then remove and add iOS platform, build the app again.

Please try it and let me know if it works for you.

Raj Kumar
  • 953
  • 1
  • 8
  • 19
  • Thanks for your answer! I realized that the plugin was not going to the Ionic Cloud Service. Re-creating the project will probably solve the problem. – eliangela Dec 01 '16 at 17:45