Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase push notifications on Android with multiple modules

I'm currently trying to implement push notifications in our application.

So we have three modules.

  • App 1
  • Logic
  • App 2

I gave them obviously names. App 1 and 2 have a dependency on the logic module. This module contains ALL the logic for both apps. Now I want App specific notifications to users that are logged in on App 1 OR App 2.

Problem:

I can't put the firebase logic into the Logic module since this module is configured as a lib module and isn't configured as an App. Now I have to put the firebase logic in App 1 and 2, but I can't access this logic from the Logic module since App 1 and 2 have a dependency on the Logic module and not the other way around.

Firebase requires a google-services.json for every app connected, this file is required to generate a user specific pushtoken.

Is there a way to configure this so that I can generate user specific tokens for push notifications? So after a user logs in a pushtoken has to be generated according to the App and user so this user can get a notifcation on said device which he/she is logged in.

I hope this is clear enough.

like image 577
Jordi Avatar asked Oct 17 '22 17:10

Jordi


1 Answers

There should be nothing stopping you from implementing what you're describing.

You can still add Firebase SDK dependencies to a library module. You just can't use the google-services plugin on it - that belongs only on application modules.

like image 187
Doug Stevenson Avatar answered Oct 21 '22 08:10

Doug Stevenson