0

My setup consists of two android apps, that use the same backend. I was sending push notifications based on the deviceID, meaning if you installed both apps on the same device, the listener of app 1 would listen also to notifications intended for app 2, and hell would break loose.

I would like to know if Firebase can support this type of project. So, does one Firebase project generates one Token per device per app, or only one Token per device? If the latest, any tips on how to get this working?

Thanks in advance.

1 Answers1

1

A registration (FCM) token corresponds to an app instance. AFAIK, different apps (unique by package name) should produce different tokens when getToken() is called regardless if it's using the same Firebase Project.

However, the usual (best?) practice is to have a separate project for every different app, then handle the multiple senders for each app.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • what happens if both app will subscribe with same token? In that case does the both app will receive same notification ? – Android Dev Jan 24 '23 at 12:08
  • @AndroidDev I'm not sure what you mean by both apps. Do you mean two different apps subscribed with the same token? If so, that shouldn't be possible since the token generated is specific to the app instance (note _unique by package name_) – AL. Jan 25 '23 at 06:48