firebase:: App
#include <app.h>
Firebase application object.
Summary
firebase::App acts as a conduit for communication between all Firebase services used by an application.
For example:
#if defined(__ANDROID__)firebase::App::Create(firebase::AppOptions(),jni_env,activity);#elsefirebase::App::Create(firebase::AppOptions());#endif// defined(__ANDROID__)
Constructors and Destructors | |
|---|---|
~App() |
Public functions | |
|---|---|
GetJNIEnv() const | JNIEnv *Get JNI environment, needed for performing JNI calls, set on creation. |
activity() const | jobjectGet a global reference to the Android activity provided to theApp on creation. |
java_vm() const | JavaVM *Get Java virtual machine, retrieved from the initial JNI environment. |
name() const | const char *Get the name of thisApp instance. |
options() const | constAppOptions &Get options theApp was created with. |
Public static functions | |
|---|---|
Create() | App *Initializes the defaultfirebase::App with default options. |
Create(JNIEnv *jni_env, jobject activity) | App *Initializes the defaultfirebase::App with default options. |
Create(constAppOptions & options) | App *Initializes the defaultfirebase::App with the given options. |
Create(constAppOptions & options, JNIEnv *jni_env, jobject activity) | App *Initializes the defaultfirebase::App with the given options. |
Create(constAppOptions & options, const char *name) | App *Initializes afirebase::App with the given options that operates on the named app. |
Create(constAppOptions & options, const char *name, JNIEnv *jni_env, jobject activity) | App *Initializes afirebase::App with the given options that operates on the named app. |
GetApps() | std::vector<App * >Get all the apps, including the default one. |
GetInstance() | App *Get the defaultApp, or nullptr if none has been created. |
GetInstance(const char *name) | App *Get theApp with the given name, or nullptr if none have been created. |
Public functions
GetJNIEnv
JNIEnv*GetJNIEnv()const
Get JNI environment, needed for performing JNI calls, set on creation.
This is not trivial as the correct environment needs to retrieved per thread.Note: This method is specific to the Android implementation.
| Details | |
|---|---|
| Returns | JNI environment object. |
activity
jobjectactivity()const
Get a global reference to the Android activity provided to theApp on creation.
Also serves as the Context needed for Firebase calls.Note: This method is specific to the Android implementation.
| Details | |
|---|---|
| Returns | Global JNI reference to the Android activity used to create theApp. The reference count of the returned object is not increased. |
java_vm
JavaVM*java_vm()const
Get Java virtual machine, retrieved from the initial JNI environment.
Note: This method is specific to the Android implementation.
| Details | |
|---|---|
| Returns | JNI Java virtual machine object. |
options
constAppOptions&options()const
~App
~App()
Public static functions
Create
App*Create()
Initializes the defaultfirebase::App with default options.
Note: This method is specific to non-Android implementations.
| Details | |
|---|---|
| Returns |
Create
App*Create(JNIEnv*jni_env,jobjectactivity)
Initializes the defaultfirebase::App with default options.
Note: This method is specific to the Android implementation.
| Details | |||||
|---|---|---|---|---|---|
| Parameters |
| ||||
| Returns |
Create
App*Create(constAppOptions&options)
Initializes the defaultfirebase::App with the given options.
| Details | |||
|---|---|---|---|
| Parameters |
| ||
| Returns |
Create
App*Create(constAppOptions&options,JNIEnv*jni_env,jobjectactivity)
Initializes the defaultfirebase::App with the given options.
| Details | |||||||
|---|---|---|---|---|---|---|---|
| Parameters |
| ||||||
| Returns |
Create
App*Create(constAppOptions&options,constchar*name)
Initializes afirebase::App with the given options that operates on the named app.
| Details | |||||
|---|---|---|---|---|---|
| Parameters |
| ||||
| Returns |
Create
App*Create(constAppOptions&options,constchar*name,JNIEnv*jni_env,jobjectactivity)
Initializes afirebase::App with the given options that operates on the named app.
| Details | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| Parameters |
| ||||||||
| Returns |
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 2024-01-23 UTC.