1

We have an app connected to default Firebase project. For Notifications, we use a Legacy (secondary) Firebase project.

I have figured out how to connect to secondary Firebase server, Auth to read from Database.

For push notifications, currently, I am using the default Firebase project generated token. But now, I am trying to see if I can generate a registration token for the secondary Firebase project so I can use the Legacy project for Push notifications.

Since FirebaseInstanceIdService is where the tokens are generated, I feel it's tied to the default Firebase service which is read from services JSON file. I still would like to keep the default JSON service file since a lot of APIs are connected using the default Firebase account.

Any idea to use the secondary Firebase project to generate token?

AL.
  • 36,815
  • 10
  • 142
  • 281
Sayooj Valsan
  • 536
  • 5
  • 16

2 Answers2

2

Just call getToken(String, String), passing the Sender ID of your Secondary Project. Like so:

getToken("2xxxxx3344", "FCM");

It will return a (different) Registration token that corresponds to the secondary project, where you can now send push notifications from.

Do keep in mind that getToken(String, String) is a blocking function so do not call it on the main thread.

Similar posts (possibly duplicate):

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
0

In the new version of the Firebase SDK, this is done using different way.

A detailed guide is explained in the answer here.

Tejas Sherdiwala
  • 750
  • 8
  • 15