capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
238 stars 83 forks source link

iOS FCM getToken #9

Closed OrhanNasuf closed 5 years ago

OrhanNasuf commented 5 years ago

How can we combine PushNotifications.addListener( 'registration') with this plugin to receive an FCM token on iOS?

I have tried this (but the promise does not fire, so we never get the "fcm_token" below):


PushNotifications.addListener("registration", (token) => {
    fcm.getToken().then(fcm_token => console.log("FCM Token:", JSON.stringify(fcm_token))); 
});

In the xcode log all we see is that we receive APNS token and then: ... To Native -> FCMPlugin getToken 655837

Any ideas?

stewones commented 5 years ago

fix is on the way

stewones commented 5 years ago

actually I made a mistake in a test, so there's no fix to do here.

just updated the demo project

@OrhanNasuf can you give it a shot?

https://github.com/stewwan/capacitor-fcm-demo

ezgif-2-6d1022881ad1