Firebase.FirebaseApp

Firebase application object.

Summary

FirebaseApp acts as a conduit for communication between allFirebase services used by an application. A default instance is created automatically, based on settings in yourFirebase configuration file, and all of theFirebase APIs connect with it automatically.

Inheritance

Inherits from: SystemIDisposable

Properties

DefaultInstance
Get the defaultFirebaseApp instance.
DefaultName
static string
Gets the default name forFirebaseApp objects.
LogLevel
staticLogLevel
Gets or sets the minimum log verbosity level forFirebase features.
Name
string
Get the name of this App instance.
Options
Get theAppOptions theFirebaseApp was created with.

Public functions

Dispose()
void
Dispose(bool disposing)
void

Public static functions

CheckAndFixDependenciesAsync()
System.Threading.Tasks.Task<DependencyStatus >
Asynchronously checks if all of the necessary dependencies forFirebase are present on the system, and in the necessary state and attempts to fix them if they are not.
CheckDependenciesAsync()
System.Threading.Tasks.Task<DependencyStatus >
Asynchronously checks if all of the necessary dependencies forFirebase are present on the system, and in the necessary state.
Create()
Initializes the defaultFirebaseApp with default options.
Create(AppOptions options)
Initializes the defaultFirebaseApp with the given options.
Create(AppOptions options, string name)
Initializes aFirebaseApp with the given options that operate on the named app.
FixDependenciesAsync()
System.Threading.Tasks.Task
Attempts to fix any missing dependencies that would preventFirebase from working on the system.
GetInstance(string name)
Get an instance of an app by name.

Classes

Firebase.FirebaseApp.EnableModuleParams

Properties

DefaultInstance

staticFirebaseAppDefaultInstance

Get the defaultFirebaseApp instance.

Details
Returns
Reference to the default app, if it hasn't been created this method will create it.

DefaultName

staticstringDefaultName

Gets the default name forFirebaseApp objects.

LogLevel

staticLogLevelLogLevel

Gets or sets the minimum log verbosity level forFirebase features.

  • LogLevel.Verbose allows all log messages to be displayed.
  • LogLevel.Assert prevents displaying all but fatal errors.

Note: SomeFirebase plugins may require you to set their LogLevel separately.

Details
Returns
The current LogLevel.

Name

stringName

Get the name of this App instance.

Details
Returns
The name of this App instance. If a name wasn't provided viaCreate(), this returnsDefaultName.

Options

AppOptionsOptions

Get theAppOptions theFirebaseApp was created with.

Details
Returns
AppOptions used to create theFirebaseApp.

Public functions

Dispose

voidDispose()

Dispose

voidDispose(booldisposing)

Public static functions

CheckAndFixDependenciesAsync

System.Threading.Tasks.Task<DependencyStatus>CheckAndFixDependenciesAsync()

Asynchronously checks if all of the necessary dependencies forFirebase are present on the system, and in the necessary state and attempts to fix them if they are not.

Note: In some cases, this operation can take a long time and in some cases may prompt the user to update other services on the device. It's recommended to perform other application specific tasks in parallel while checking and potentially fixing dependencies forFirebase.If it's appropriate for your app to handle checking and fixing dependencies separately, you can. Here's effectively what CheckAndFixDependenciesAsync does:

usingSystem.Threading.Tasks;// Needed for the Unwrap extension method.// ...Firebase.FirebaseApp.CheckDependenciesAsync().ContinueWith(checkTask=>{// Peek at the status and see if we need to try to fix dependencies.Firebase.DependencyStatusstatus=checkTask.Result;if(status!=Firebase.DependencyStatus.Available){returnFirebase.FirebaseApp.FixDependenciesAsync().ContinueWith(t=>{returnFirebase.FirebaseApp.CheckDependenciesAsync();}).Unwrap();}else{returncheckTask;}}).Unwrap().ContinueWith(task=>{dependencyStatus=task.Result;if(dependencyStatus==Firebase.DependencyStatus.Available){// TODO: Continue with Firebase initialization.}else{Debug.LogError("Could not resolve all Firebase dependencies: "+dependencyStatus);}});

Details
Returns
A Task that on completion will contain the DependencyStatus enum value, indicating the state of the required dependencies.

CheckDependenciesAsync

System.Threading.Tasks.Task<DependencyStatus>CheckDependenciesAsync()

Asynchronously checks if all of the necessary dependencies forFirebase are present on the system, and in the necessary state.

Note: In some cases, this operation can take a long time. It's recommended to perform other application specific tasks in parallel while checking dependencies forFirebase.

Details
Returns
A Task that on completion will contain the DependencyStatus enum value, indicating the state of the required dependencies.

Create

FirebaseAppCreate()

Initializes the defaultFirebaseApp with default options.

Details
Returns
NewFirebaseApp instance.

Create

FirebaseAppCreate(AppOptionsoptions)

Initializes the defaultFirebaseApp with the given options.

Details
Parameters
options
Options that control the creation of theFirebaseApp.
Returns
NewFirebaseApp instance.

Create

FirebaseAppCreate(AppOptionsoptions,stringname)

Initializes aFirebaseApp with the given options that operate on the named app.

Details
Parameters
options
Options that control the creation of theFirebaseApp.
name
Name of thisFirebaseApp instance. This is only required when one application uses multipleFirebaseApp instances.
Returns
NewFirebaseApp instance.

FixDependenciesAsync

System.Threading.Tasks.TaskFixDependenciesAsync()

Attempts to fix any missing dependencies that would preventFirebase from working on the system.

Since this function is asynchronous, the returned Task must be monitored in order to tell when it has completed. Also note, that depending on the fixes necessary, the user may be prompted for additional input.

Details
Returns
System.Threading.Tasks.Task A task that tracks the progress of the fix.

GetInstance

FirebaseAppGetInstance(stringname)

Get an instance of an app by name.

Details
Parameters
name
Name of the app to retrieve.
Returns
Reference to the app if it was previously created, null otherwise.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-07-20 UTC.