Stay organized with collections
Save and categorize content based on your preferences.
firebase::AppOptions
#include <app.h>
Options that control the creation of a Firebase App.
Summary
See also:
firebase::App
Public functions
|
api_key() const
|
const char *
Get the API key.
|
app_id() const
|
const char *
Retrieves the app ID.
|
database_url() const
|
const char *
Get database root URL, e.g.
|
messaging_sender_id() const
|
const char *
Get the Firebase Cloud Messaging sender ID.
|
project_id() const
|
const char *
Get the Google Cloud project ID.
|
set_api_key(const char *key)
|
void
API key used to authenticate requests from your app.
|
set_app_id(const char *id)
|
void
Set the Firebase app ID used to uniquely identify an instance of an app.
|
set_database_url(const char *url)
|
void
|
set_messaging_sender_id(const char *sender_id)
|
void
Set the Firebase Cloud Messaging sender ID.
|
set_project_id(const char *project)
|
void
Set the Google Cloud project ID.
|
set_storage_bucket(const char *bucket)
|
void
Set the Google Cloud Storage bucket name, e.g.
|
storage_bucket() const
|
const char *
Get the Google Cloud Storage bucket name,.
|
Public functions
api_key
const char * api_key() const
app_id
const char * app_id() const
database_url
const char * database_url() const
messaging_sender_id
const char * messaging_sender_id() const
project_id
const char * project_id() const
Get the Google Cloud project ID.
This is the project_id in the Android google-services.json config file or PROJECT_ID in the GoogleService-Info.plist.
set_api_key
void set_api_key(
const char *key
)
API key used to authenticate requests from your app.
For example, "AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk" used to identify your app to Google servers.
This only needs to be specified if your application does not include google-services.json or GoogleService-Info.plist in its resources.
set_app_id
void set_app_id(
const char *id
)
Set the Firebase app ID used to uniquely identify an instance of an app.
This is the mobilesdk_app_id in the Android google-services.json config file or GOOGLE_APP_ID in the GoogleService-Info.plist.
This only needs to be specified if your application does not include google-services.json or GoogleService-Info.plist in its resources.
set_database_url
void set_database_url(
const char *url
)
set_messaging_sender_id
void set_messaging_sender_id(
const char *sender_id
)
Set the Firebase Cloud Messaging sender ID.
For example "012345678901", used to configure Firebase Cloud Messaging.
This only needs to be specified if your application does not include google-services.json or GoogleService-Info.plist in its resources.
set_project_id
void set_project_id(
const char *project
)
Set the Google Cloud project ID.
set_storage_bucket
void set_storage_bucket(
const char *bucket
)
Set the Google Cloud Storage bucket name, e.g.
\"abc-xyz-123.storage.firebase.com\".
storage_bucket
const char * storage_bucket() const
Public static functions
LoadFromJsonConfig
AppOptions * LoadFromJsonConfig(
const char *config,
AppOptions *options
)
Load options from a config string.
Details |
Parameters |
config
|
A JSON string that contains Firebase configuration i.e. the content of the downloaded google-services.json file.
|
options
|
Optional: If provided, load options into it.
|
|
Returns
|
An instance containing the loaded options if successful. If the options argument to this function is null, this method returns an AppOptions instance allocated from the heap.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.
[null,null,["Last updated 2024-01-23 UTC."],[],[],null,["# firebase::AppOptions Class Reference\n\nfirebase::AppOptions\n====================\n\n\n`#include \u003capp.h\u003e`\n\nOptions that control the creation of a Firebase [App](/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app).\n\nSummary\n-------\n\n\n**See also:**\n[firebase::App](/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app)\n\n| ### Constructors and Destructors ||\n|---|---|\n| [AppOptions](#classfirebase_1_1_app_options_1a5e50b35c610e27f7f2b4f0318055dd47)`()` Create [AppOptions](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options). ||\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [api_key](#classfirebase_1_1_app_options_1af27ddadf6ddfe379fb821d0fd7954d22)`() const ` | `const char *` Get the API key. |\n| [app_id](#classfirebase_1_1_app_options_1a16d96ca57e90a5bc30a0a6fb94f79459)`() const ` | `const char *` Retrieves the app ID. |\n| [database_url](#classfirebase_1_1_app_options_1ad0261ff25346f8a4d82da2915ec58646)`() const ` | `const char *` Get database root URL, e.g. |\n| [messaging_sender_id](#classfirebase_1_1_app_options_1a0248e9f0fdb164d3d33383c0f4756183)`() const ` | `const char *` Get the Firebase Cloud Messaging sender ID. |\n| [project_id](#classfirebase_1_1_app_options_1a5831a8c77eec92e30813f16a7655b853)`() const ` | `const char *` Get the Google Cloud project ID. |\n| [set_api_key](#classfirebase_1_1_app_options_1ac8ed231504a8c11838ed53f9b2ebf253)`(const char *key)` | `void` API key used to authenticate requests from your app. |\n| [set_app_id](#classfirebase_1_1_app_options_1a67573953fe43ce9b8cff6b0602409140)`(const char *id)` | `void` Set the Firebase app ID used to uniquely identify an instance of an app. |\n| [set_database_url](#classfirebase_1_1_app_options_1a171ef782c65c4deb5d8a109f985cef09)`(const char *url)` | `void` Set the database root URL, e.g. \"\u003chttp://abc-xyz-123.firebaseio.com\u003e\". |\n| [set_messaging_sender_id](#classfirebase_1_1_app_options_1a6f0824a31d908b059316af8b3c595506)`(const char *sender_id)` | `void` Set the Firebase Cloud Messaging sender ID. |\n| [set_project_id](#classfirebase_1_1_app_options_1af2f9f576035e5eb289817cf2c0dd525c)`(const char *project)` | `void` Set the Google Cloud project ID. |\n| [set_storage_bucket](#classfirebase_1_1_app_options_1a9c651c380ee603d7028c5c03ee5c5307)`(const char *bucket)` | `void` Set the Google Cloud Storage bucket name, e.g. |\n| [storage_bucket](#classfirebase_1_1_app_options_1a41bdfb8021440feac759d944ea6f5d34)`() const ` | `const char *` Get the Google Cloud Storage bucket name,. |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| [LoadFromJsonConfig](#classfirebase_1_1_app_options_1a54f8d0909118ba7937362f36a259d91c)`(const char *config, `[AppOptions](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options)` *options)` | [AppOptions](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options)` *` Load options from a config string. |\n\nPublic functions\n----------------\n\n### AppOptions\n\n```c++\n AppOptions()\n``` \nCreate [AppOptions](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options).\n\nTo create a [firebase::App](/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) object, the Firebase application identifier and API key should be set using [set_app_id()](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options_1a67573953fe43ce9b8cff6b0602409140) and [set_api_key()](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options_1ac8ed231504a8c11838ed53f9b2ebf253) respectively.\n\n**See also:** [firebase::App::Create()](/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app_1a5161747a9bbed350214cb5e1c0a23503). \n\n### api_key\n\n```c++\nconst char * api_key() const \n``` \nGet the API key.\n\n**See also:** [set_api_key()](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options_1ac8ed231504a8c11838ed53f9b2ebf253). \n\n### app_id\n\n```c++\nconst char * app_id() const \n``` \nRetrieves the app ID.\n\n**See also:** [set_app_id()](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options_1a67573953fe43ce9b8cff6b0602409140). \n\n### database_url\n\n```c++\nconst char * database_url() const \n``` \nGet database root URL, e.g.\n\n\"\u003chttp://abc-xyz-123.firebaseio.com\u003e\". \n\n### messaging_sender_id\n\n```c++\nconst char * messaging_sender_id() const \n``` \nGet the Firebase Cloud Messaging sender ID.\n\n**See also:** [set_messaging_sender_id()](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options_1a6f0824a31d908b059316af8b3c595506). \n\n### project_id\n\n```c++\nconst char * project_id() const \n``` \nGet the Google Cloud project ID.\n\nThis is the project_id in the Android google-services.json config file or PROJECT_ID in the GoogleService-Info.plist. \n\n### set_api_key\n\n```c++\nvoid set_api_key(\n const char *key\n)\n``` \nAPI key used to authenticate requests from your app.\n\nFor example, \"AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk\" used to identify your app to Google servers.\n\nThis only needs to be specified if your application does not include google-services.json or GoogleService-Info.plist in its resources. \n\n### set_app_id\n\n```c++\nvoid set_app_id(\n const char *id\n)\n``` \nSet the Firebase app ID used to uniquely identify an instance of an app.\n\nThis is the mobilesdk_app_id in the Android google-services.json config file or GOOGLE_APP_ID in the GoogleService-Info.plist.\n\nThis only needs to be specified if your application does not include google-services.json or GoogleService-Info.plist in its resources. \n\n### set_database_url\n\n```c++\nvoid set_database_url(\n const char *url\n)\n``` \nSet the database root URL, e.g. \"\u003chttp://abc-xyz-123.firebaseio.com\u003e\". \n\n### set_messaging_sender_id\n\n```c++\nvoid set_messaging_sender_id(\n const char *sender_id\n)\n``` \nSet the Firebase Cloud Messaging sender ID.\n\nFor example \"012345678901\", used to configure Firebase Cloud Messaging.\n\nThis only needs to be specified if your application does not include google-services.json or GoogleService-Info.plist in its resources. \n\n### set_project_id\n\n```c++\nvoid set_project_id(\n const char *project\n)\n``` \nSet the Google Cloud project ID. \n\n### set_storage_bucket\n\n```c++\nvoid set_storage_bucket(\n const char *bucket\n)\n``` \nSet the Google Cloud Storage bucket name, e.g.\n\n\\\\\"abc-xyz-123.storage.firebase.com\\\\\". \n\n### storage_bucket\n\n```c++\nconst char * storage_bucket() const \n``` \nGet the Google Cloud Storage bucket name,.\n\n**See also:** [set_storage_bucket()](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options_1a9c651c380ee603d7028c5c03ee5c5307).\n\nPublic static functions\n-----------------------\n\n### LoadFromJsonConfig\n\n```c++\nAppOptions * LoadFromJsonConfig(\n const char *config,\n AppOptions *options\n)\n``` \nLoad options from a config string.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |-----------|------------------------------------------------------------------------------------------------------------------| | `config` | A JSON string that contains Firebase configuration i.e. the content of the downloaded google-services.json file. | | `options` | Optional: If provided, load options into it. | |\n| **Returns** | An instance containing the loaded options if successful. If the options argument to this function is null, this method returns an [AppOptions](/docs/reference/cpp/class/firebase/app-options#classfirebase_1_1_app_options) instance allocated from the heap. |"]]