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()
static List<FirebaseApp> getApps(Context context)
Returns a mutable list of all FirebaseApps.
static FirebaseApp getInstance(String name)
static FirebaseApp getInstance()
String getName()
FirebaseOptions getOptions()
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

Constants

public static final String DEFAULT_APP_NAME

Constant Value: "[DEFAULT]"

Public Methods

public boolean equals (Object o)

public Context getApplicationContext ()

Returns

public static List<FirebaseApp> getApps (Context context)

Returns a mutable list of all FirebaseApps.

public static FirebaseApp getInstance (String name)

Parameters
name represents the name of the FirebaseApp instance.
Returns
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

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
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 ()