Initialize Push Notification connection to different Firebase projects during runtime

I have successfully implemented push notification in our Capacitor app (using Angular), but I have not been able to figure out a way to initialize the connection during runtime (without using the google-service.json).
Currently our app only supports Android, but in the future we plan to support IOS as well.

I have seen that this is possible by implementing FCM in a native app.
On Android, they use “FirebaseOptions.Builder builder = …;” for configuration and then initializing the app by calling “FirebaseApp.initializeApp(this, builder.build());”

The reason why I need to support separate Firebase projects is that our app connects to different servers, so each client has its own server and Firebase account and generates its own notifications.

If this is not possible, is there any way to isolate one customer from another?

I am very grateful for any help.

In case anyone is facing the same problem, I’ve got this work with OneSignal.
HowTo: Ionic/Cordova/Capacitor SDK
Official Website: https://onesignal.com/

Happy Coding
Jones777

Interesting use case. For reference: I plan to support this in a future Capacitor Firebase version, see feat: change Firebase project at runtime · Issue #653 · capawesome-team/capacitor-firebase · GitHub.

1 Like