android FCM, how to work with more than one FCM projects in a app

31 views
Skip to first unread message

Lanny Ford

unread,
Mar 15, 2023, 2:45:07 PM3/15/23
to Firebase Google Group
In one android app, it has dependencies on some libraries and the library may have integrated with its own FCM project (should have its own pushtoken, and and its own backend to send the push against the respected pushtoken).

So each library has its own goole-services.json generated from its FCM project.
and has its own token listener, e.g.
```
class Proj_x_FirebaseMessagingService : FirebaseMessagingService {

    public void onNewToken(String s) {
        ...
    }
}
```

But when run the app only one library gets the FCM pushtoken.

ref: https://stackoverflow.com/questions/42117592/receive-push-notifications-on-one-android-app-from-two-firebase-projects,
mentioned about using `getToken("2xxxxx3344", "FCM")` but [it is deprecated][1]

There is also [use multiple projects in your application][2]
But not really sure how to use it. Especially if it requires change inside the depended libraries.

How to work with multiple FCM projects in one app?


  [1]: https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId.html#getToken(java.lang.String,%20java.lang.String)
  [2]: https://firebase.google.com/docs/projects/multiprojects
Reply all
Reply to author
Forward
0 new messages