If you have an application and want to use this app (module) as a library for the other one with both supporting there own FCM then you are at the right place. One might get confused as we will not recreate or rewrite FirebaseInstanceIdService, both the applications will use the single Service that will be defined in the library module. The google-services.json file and the application Id for the project will do all the work for you.
You just have to provide their respective google-services.json files in main module folder as
But don’t for get to add the google-services plugin in build.gradle file of both the modules as this will cause the generation of tokens for only the one module that has this plugin. Many times we forgot to add this plugin to upper level module (i.e MainApplication) and end up with a Firebase Token of library module.
1 |
apply plugin: 'com.google.gms.google-services' |
And you are ready to go and one more thing if you are using Topic messaging and just subscribed to a new topic then it will take atleast 3- 4 hours to appear in your Firebase console so there is nothing to worry. Thats all for today. Happy Coding!