capacitor-community / fcm

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

Topic subscription not working after refreshing token #159

Open vincentsartoko opened 1 month ago

vincentsartoko commented 1 month ago

Describe the bug I want to refresh token everytime an application loads, and then subscribe to a topic. After refreshing the token + subscribing to a topic, notifications are not sent. When I remove the refreshToken() code, everything works normally.

To Reproduce

// notifications sent to topic 'topic_id' doesn't work 
await FCM.refreshToken();
await PushNotifications.register();
await FCM.subscribeTo({ topic: 'topic_id' });

// notifications sent to topic 'topic_id' works 
await PushNotifications.register();
await FCM.subscribeTo({ topic: 'topic_id' });

Expected behavior Whether having refreshToken() or not, topic subscription should still work.

Smartphone (please complete the following information):