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).
initializeApp(FirebaseOptions)
initializes the default app instance. This
method should be invoked at startup.
Constant Summary
String | DEFAULT_APP_NAME |
Public Method Summary
void |
delete()
Deletes this
FirebaseApp object, and releases any local state and managed resources
associated with it. |
boolean |
equals(Object o)
|
static List<FirebaseApp> |
getApps()
Returns a 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(String name)
Initializes a named
FirebaseApp instance using Google Application Default Credentials. |
static FirebaseApp |
initializeApp(FirebaseOptions options, String name)
Initializes a named
FirebaseApp instance using the given options. |
static FirebaseApp |
initializeApp()
Initializes the default
FirebaseApp instance using Google Application Default
Credentials. |
static FirebaseApp |
initializeApp(FirebaseOptions options)
Initializes the default
FirebaseApp instance using the given options. |
String |
toString()
|
Inherited Method Summary
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
Public Methods
public void delete ()
Deletes this FirebaseApp
object, and releases any local state and managed resources
associated with it. All calls to this FirebaseApp
instance will throw once this method
has been called. This also releases any managed resources allocated by other services
attached to this object instance (e.g. FirebaseAuth
).
A no-op if delete was called before.
public boolean equals (Object o)
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. |
---|
Returns
- the
FirebaseApp
corresponding to the name.
Throws
IllegalStateException | if the FirebaseApp was not initialized, either via initializeApp(FirebaseOptions, String) or getApps() .
|
---|
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 int hashCode ()
public static FirebaseApp initializeApp (String name)
Initializes a named FirebaseApp
instance using Google Application Default Credentials.
Loads additional FirebaseOptions
from the environment in the same way as the
initializeApp()
method.
Throws
IllegalStateException | if an app with the same name has already been initialized. |
---|---|
IllegalArgumentException | if an error occurs while loading options from the environment. |
public static FirebaseApp initializeApp (FirebaseOptions options, String name)
Initializes a named FirebaseApp
instance using the given options.
Parameters
options | represents 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 has already been initialized. |
---|
public static FirebaseApp initializeApp ()
Initializes the default FirebaseApp
instance using Google Application Default
Credentials. Also attempts to load additional FirebaseOptions
from the environment
by looking up the FIREBASE_CONFIG
environment variable. If the value of
the variable starts with '{'
, it is parsed as a JSON object. Otherwise it is
treated as a file name and the JSON content is read from the corresponding file.
Throws
IllegalStateException | if the default app has already been initialized. |
---|---|
IllegalArgumentException | if an error occurs while loading options from the environment. |
public static FirebaseApp initializeApp (FirebaseOptions options)
Initializes the default FirebaseApp
instance using the given options.
Throws
IllegalStateException | if the default app has already been initialized. |
---|