Open dani12817 opened 4 years ago
My fix...
// Push notification settings...
PushNotifications.register().then(() => console.log(`registered for push`));
// Select platform
if (this.platform.is('android')) {
PushNotifications.addListener('registration',
(token: PushNotificationToken) => {
console.log('Push registration success, token: ' + token.value);
}
);
} else {
PushNotifications.addListener('registration', () => {
console.log('Registered...');
});
// Get FCM token instead the APN one returned by Capacitor
fcm
.getToken()
.then(r => console.log(`Token ${r.token}`))
.catch(err => console.log(err));
}
PushNotifications.addListener(
'pushNotificationReceived',
(notification: PushNotification) => {
console.log(notification);
}
);
I'm trying this demo you made, but I'm always getting this error when I try to get the FCM Token, I can only get the Token if I use 'PushNotifications.addListener('registration')'.