question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FirebaseApp.Create not override default instance

See original GitHub issue

Please fill in the following fields:

Unity editor version: 2018.421f Firebase Unity SDK version: 6.12.0 Source you installed the SDK : unitypackage Firebase plugins in use : Auth FireStore Additional SDKs you are using : Facebook AdMob VoxelBusters Platform you are using the Unity editor on : Windows Platform you are targeting : Android Scripting Runtime : IL2CPP

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

	FirebaseApp.LogLevel = Firebase.LogLevel.Verbose;
	var status  = await FirebaseApp.CheckAndFixDependenciesAsync();
	var main = FirebaseApp.Create(new AppOptions() {
		ProjectId = "{another}",
		StorageBucket = "{anotherBucket}"
	});

With the code above, the main.Options.ProjectId and DefaultInstance still being the ID from config.json. Is it a bug or is it intended?

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

  • Don’t know

What’s the issue repro rate? (eg 100%, 1/5 etc)

  • 100%

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Thainacommented, Feb 13, 2021

@cynthiajoan In my case I try to switch the default firebase app in my app on the fly. I have firebase app for test and for production. And I have a button to switch it. But then the app was not be created for the specified project as intended

This should be consider a bug because when we try to create the app, it should be created with projectID as a unique key, or we might try to specified more data with new AppOptions. And for the current behaviour the name is misleading. It should be GetOrCreate instead of plain Create

0reactions
cynthiajoancommented, Feb 13, 2021

Hi @Thaina, I checked the implementation detail, and yes if we see the project name is same with the default name, we will use the default option that set in the json files. I’d like to get more context of the use case that we have the need of creating multiple projects with the same default name but different options, based on that we can discuss if we want to change this behavior.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overwrite DefaultInstance of the firebase app. Re-initialize: ...
Overwrite DefaultInstance of the firebase app. ... public async Task<bool> TryDeleteFirebaseAppAsync(string name) { var apps = FirebaseApp.
Read more >
Firebase Remote Config - Google
To override in-app default values, you use the Firebase console or the Remote Config backend APIs to create parameters with the same names...
Read more >
React Native Firebase
Welcome to React Native Firebase! To get started, you must first setup a Firebase project and install the "app" module.
Read more >
FirebaseAuthOAuth class - firebase_apple_auth library
The instance of FirebaseAuth will be from the default Firebase App Unless withApp is ... User An error will be throw if there's...
Read more >
Working with multiple Firebase projects in an Android app
Firebase provides a bunch of features to use together in your app, provided by a project that you create at the Firebase console....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found