Summary: Constants | Methods | Inherited Methods | [Expand All]
public class

# FirebaseApp

extends Object

java.lang.Object
↳ | com.google.firebase.FirebaseApp

## Class Overview

The entry point of Firebase SDKs. It holds common configuration and state for Firebase APIs. Most applications don't need to directly interact with FirebaseApp.

Firebase APIs use the default FirebaseApp by default, unless a different one is explicitly passed to the API via FirebaseFoo.getInstance(firebaseApp).

The default app instance is initialized on app startup by `FirebaseInitProvider`. This is added to the app's manifest by Gradle manifest merging. If the app is using a different build system the provider needs to be manually added to the app's manifest.

Alternatively `initializeApp(Context, FirebaseOptions)` initializes the default app instance. This method should be invoked from `Application`. This is also necessary if it is used outside of the application's main process.

## Summary

Constants
String | DEFAULT_APP_NAME |

Public Methods
boolean | equals(Object o)
Context | getApplicationContext() Returns the application `Context`.
static List<FirebaseApp> | getApps(Context context) Returns a mutable list of all FirebaseApps.
static FirebaseApp | getInstance(String name) Returns the instance identified by the unique name, or throws if it does not exist.
static FirebaseApp | getInstance() Returns the default (first initialized) instance of the `FirebaseApp`.
String | getName() Returns the unique name of this app.
FirebaseOptions | getOptions() Returns the specified `FirebaseOptions`.
int | hashCode()
static FirebaseApp | initializeApp(Context context, FirebaseOptions options, String name) A factory method to intialize a `FirebaseApp`.
static FirebaseApp | initializeApp(Context context, FirebaseOptions options) Initializes the default `FirebaseApp` instance.
String | toString()

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Constants

#### public static final String DEFAULT_APP_NAME

Constant Value: "[DEFAULT]"

## Public Methods

#### public boolean equals (Object o)

#### public Context getApplicationContext ()

Returns the application `Context`.

#### public static List<FirebaseApp> getApps (Context context)

Returns a mutable list of all FirebaseApps.

#### public static FirebaseApp getInstance (String name)

Returns the instance identified by the unique name, or throws if it does not exist.

##### Parameters

name | represents the name of the `FirebaseApp` instance.

##### Throws

IllegalStateException | if the `FirebaseApp` was not initialized, either via `initializeApp(Context, FirebaseOptions, String)`.

#### public static FirebaseApp getInstance ()

Returns the default (first initialized) instance of the `FirebaseApp`.

##### Throws

IllegalStateException | if the default app was not initialized.

#### public String getName ()

Returns the unique name of this app.

#### public FirebaseOptions getOptions ()

Returns the specified `FirebaseOptions`.

#### public int hashCode ()

#### public static FirebaseApp initializeApp (Context context, FirebaseOptions options, String name)

A factory method to intialize a `FirebaseApp`.

##### Parameters

context | represents the `Context`
options | represent the global `FirebaseOptions`
name | unique name for the app. It is an error to initialize an app with an already existing name. Starting and ending whitespace characters in the name are ignored (trimmed).

##### Returns

- an instance of `FirebaseApp`

##### Throws

IllegalStateException | if an app with the same name but different parameters was already initialized.

#### public static FirebaseApp initializeApp (Context context, FirebaseOptions options)

Initializes the default `FirebaseApp` instance. Same as `initializeApp(Context, FirebaseOptions)`, but it uses `DEFAULT_APP_NAME` as name.

The creation of the default instance is automatically triggered at app startup time, if Firebase configuration values are available from resources - populated from google-services.json.

#### public String toString ()