I'm trying integrate Firebase Cloud Messaging, specifically for android push notifications, into a my own library module so I can easily implement this into any app without having to touch Firebase. I have successfully integrated it initializing the Firebase Messaging SDK dynamically inside my library by using FirebaseOptions.Builder as well it generated a push token.
BTW I am initializing FirebaseApp in my library and calling it in the app MainActivity.java
But whenever I test sending my own push notification while the app is in the foreground I get
Default FirebaseApp is not initialized in this process. Make sure to call FirebaseApp.initializeApp(Context)
From the Error Output it seems to be calling FirebaseApp instance in the MessagingAnalytics class to log performance before it calls onMessageRecieved.
As well no notification shows up on the phone when sending a Notification while the app is in the background.
I want my library module to handle everything to do with Push Notifications, I have also created a MyMessagingService in the library module and added the appropriate Service in the manifest of the library module.
If anyone has done this before with FCM in a library or knows how to fix these crashes please let me know.
EDIT
I am building the FirebaseApp manually without google-service.json inside the module. Like this:
FirebaseApp.initializeApp(context, new FirebaseOptions.Builder().setApplicationId(applicationID).setApiKey(apiKey).setGcmSenderId(senderID).setProjectId(projectID).build());