How to Dynamically Switch Between Test and Production Firebase Analytics Environments in Defold

I’m developing an app with Defold and would like to dynamically switch between test and production environments in Firebase Analytics. However, the standard Firebase extension for Defold (extension-firebase) doesn’t seem to support runtime initialization of multiple Firebase apps using FirebaseOptions or the management of multiple apps via identifiers.

It appears that the only current options are to replace the google-services.json (for Android) or GoogleService-Info.plist (for iOS) before building, or to create/modify a native extension to use FirebaseOptions. Does anyone have any experience or insights on how to achieve this? Any help would be greatly appreciated!

How would you do this in a Java based app or in some other game engine with support for Firebase Analytics?

I’m a beginner, and I’ve never developed a real Java-based app before. Defold is the first game engine I’ve ever used, and this is also my first time working with Firebase Analytics.
So, what do you think I should do?

Ok. The reason I asked was that the question seemed fairly specific and like something which is supported and commonly done by others when using Firebase Analytics. Please look through the Firebase Analytics documentation and try to find anything in the official documentation about how to do this, and link it here.

First of all, thank you so much for your quick reply!!

Previously, I used Playfab to collect user data. However, I’m currently migrating to Firebase Analytics because I want to perform more comprehensive analysis of user data. Here’s how I switched between test and release versions when using Playfab.

Since Firebase cannot simply switch a TitleID like Playfab does and instead requires reading xml/plist files, using the same switching method as Playfab does not solve the issue I’m facing.

	if sys.get_engine_info().is_debug then
		PlayFabClientApi.settings.titleId = "playfab_ID_for_test"
	else
		go.delete("debug")
		PlayFabClientApi.settings.titleId = "playfab_ID_for_release"
		logger.level(logger.ERROR)
	end

I will share the relevant Firebase Analytics documentation links on this forum later!