I integrated Firebase Push Notification in my ionic capacitor app.
It works on Android but on iOS registration listener not fired after permission granted. I can’t understand why.
PushNotifications.addListener('registration', (token: Token) => {
alert('Push registration success, token: ' + token.value);
this.push.registerToken(token.value);
});
PushNotifications.addListener('registrationError', (error: any) => {
alert('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener(
'pushNotificationReceived',
(notification: PushNotificationSchema) => {
alert('Push received: ' + JSON.stringify(notification));
},
);
PushNotifications.addListener(
'pushNotificationActionPerformed',
(notification: ActionPerformed) => {
alert('Push action performed: ' + JSON.stringify(notification));
},
);
PushNotifications.requestPermissions().then(result => {
if (result.receive === 'granted') {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register().then((response) => {
alert("registration complete");
console.log('[NOTIFICATIONS] register complete: ', response);
}, (err) => {
alert("registration error");
console.error('[NOTIFICATIONS] register error: ', err);
});
} else {
// Show some error
}
});
alert(“registration complete”); is called but after nothing
Could you please help me to understand?