Enable Android FCM when Firebase is dinamically initialised

Viewed 20

I am initializing Firebase dynamically with FirebaseApp.initializeApp(Builder) with all the project attributes set(including gcmSenderId), so I have no google services JSON in the project root as I'm choosing the firebase project at login. Everything works fine(auth sdk, firestore sdk, storage sdk etc.) apart from FCM. I'm getting the token successfully through onNewToken() method and then trying to send a test push to the token. I'm not getting the test push.

I've tried to set "firebase_messaging_auto_init_enabled" and "firebase_analytics_collection_enabled" to false and then after initializeApp to call FirebaseMessaging.getInstance().setAutoInitEnabled(true); but still doesn't work.

I can see in the logs that "Missing google_app_id. Firebase Analytics disabled. See ..." error is thrown so this may be the reason it's not working, but can't figure out why as google services json is missing intentionally and everything is fine after dynamically setting up Firebase.

0 Answers
Related