有其他挑戰或沒有在下面列出您的問題嗎?請報告錯誤或請求功能並加入Stack Overflow討論。
Firebase 項目和 Firebase 應用
什麼是 Firebase 項目?
Firebase 項目是 Firebase 的頂級實體。在項目中,您可以註冊您的 Apple、Android 或 Web 應用程序。在向 Firebase 註冊您的應用程序後,您可以將產品特定的 Firebase SDK添加到您的應用程序,例如 Analytics、Cloud Firestore、Crashlytics 或 Remote Config。
您應該在單個 Firebase 項目中註冊您的 Apple、Android 和 Web 應用變體。您可以使用多個 Firebase 項目來支持多種環境,例如開發、暫存和生產。
以下是一些用於詳細了解 Firebase 項目的資源:
- 了解 Firebase 項目- 簡要概述了有關 Firebase 項目的幾個重要概念,包括它們與 Google Cloud 的關係以及項目及其應用和資源的基本層次結構。
- 設置 Firebase 項目的一般最佳實踐- 提供用於設置 Firebase 項目和向項目註冊您的應用程序的一般高級最佳實踐,以便您擁有使用不同環境的清晰開發工作流。
請注意,對於所有 Firebase 項目,Firebase 會自動在 Google Cloud Console 的項目標籤頁面中添加firebase:enabled
標籤。在我們的常見問題解答中了解有關此標籤的更多信息。
什麼是 Google Cloud 組織?
Google Cloud 組織是 Google Cloud 項目(包括 Firebase 項目)的容器。此層次結構可以更好地組織、訪問管理和審核您的 Google Cloud 和 Firebase 項目。有關詳細信息,請參閱創建和管理組織。
如何將 Firebase 添加到現有的 Google Cloud 項目?
您可能有通過Google Cloud Console或Google APIs 控制台管理的現有項目。默認情況下,這些項目在Firebase 控制台中可見,但不被視為 Firebase 項目。
要將 Firebase 添加到您現有的 Google Cloud 項目,請點擊Firebase 控制台登錄頁面上的添加項目,然後在項目名稱菜單中選擇您的項目。
為什麼我的 Google Cloud 項目有firebase:enabled
標籤?
在 Google Cloud Console 中您的項目的標籤頁面中,您可能會看到firebase:enabled
標籤(具體來說, Value
enabled
的firebase
Key
)。
Firebase 自動添加了此標籤,因為您的項目是一個 Firebase 項目,這意味著您的項目啟用了特定於 Firebase 的配置和服務。詳細了解Firebase 項目與 Google Cloud 之間的關係。
我們強烈建議您不要修改或刪除此標籤。 Firebase 和 Google Cloud 使用此標籤列出您的 Firebase 項目(例如,通過REST API projects.list
端點或在 Firebase 控制台的菜單中)。
請注意,手動將此標籤添加到您的項目標籤列表不會為您的 Google Cloud 項目啟用特定於 Firebase 的配置和服務。為此,您需要通過Firebase 控制台(或者對於高級用例,通過Firebase 管理 REST API或Firebase CLI )添加 Firebase。
為什麼我的 Firebase 項目沒有出現在我的 Firebase 項目列表中?
如果您在以下位置看不到您的 Firebase 項目,則此常見問題解答適用:
- 在您在 Firebase 控制台中查看的項目列表中
- 在調用REST API
projects.list
端點的響應中 - 在運行 Firebase CLI 命令
firebase projects:list
的響應中
請嘗試以下故障排除步驟:
- 首先,嘗試通過直接訪問項目的 URL 來訪問您的項目。使用以下格式:
https://console.firebase.google.com/project/ PROJECT-ID /overview
- 如果您無法訪問項目或收到權限錯誤,請檢查以下內容:
- 確保您使用有權訪問該項目的同一 Google 帳戶登錄 Firebase。您可以通過控制台右上角的帳戶頭像登錄和退出 Firebase 控制台。
- 檢查您是否可以在Google Cloud Console中查看該項目。
- 確保您的項目在 Google Cloud Console 的“標籤”頁面中具有標籤
firebase:enabled
。 Firebase 和 Google Cloud 使用此標籤列出您的 Firebase 項目。如果您沒有看到此標籤,但您的項目已啟用 Firebase Management API ,請手動添加標籤(具體來說,一個Value
enabled
的firebase
Key
)。 - 確保為您分配了一種基本 IAM 角色(所有者、編輯者、查看者)或其中具有 Firebase 相關權限的角色,例如Firebase 預定義角色。您可以在 Google Cloud Console 的IAM頁面中查看您的角色。
- 如果您的項目屬於 Google Cloud 組織,您可能需要額外的權限才能查看 Firebase 控制台中列出的項目。聯繫管理您的 Google Cloud 組織的人員,以授予您查看項目的適當角色,例如瀏覽器角色。
如果上述問題排查步驟均無法讓您在 Firebase 項目列表中看到您的項目,請聯繫Firebase 支持。
每個帳戶可以擁有多少個項目?
- Spark 定價計劃——您的項目配額僅限於少量項目(通常在 5-10 個左右)。
- Blaze 定價計劃 - 只要您的 Cloud Billing 帳戶信譽良好,您的每個 Cloud Billing 帳戶的項目配額就會大幅增加。
項目配額的限制對於大多數開發者來說很少是一個問題,但如果需要,您可以請求增加您的項目配額。
請注意,完全刪除項目需要 30 天,並且在完全刪除之前會計入您的配額。
一個 Firebase 項目中可以有多少個 Firebase 應用程序?
Firebase 項目是跨 Apple、Android 和 Web 的 Firebase 應用程序的容器。 Firebase 將 Firebase 項目中的 Firebase 應用程序總數限制為 30。
在這個數字之後,性能開始下降(尤其是對於 Google Analytics),最終,在應用程序數量增加時,一些產品功能停止工作。此外,將 Firebase 應用程序添加到項目會創建一個或多個基礎 OAuth 2.0 客戶端 ID。在一個項目中最多只能創建 30 個客戶端 ID。
從最終用戶的角度來看,您應該確保單個 Firebase 項目中的所有 Firebase 應用程序都是同一應用程序的平台變體。例如,如果您開發一個白標籤應用程序,每個獨立標籤的應用程序都應該有自己的 Firebase 項目,但該標籤的 Apple 和 Android 版本可以在同一個項目中。在我們關於設置 Firebase 項目的一般最佳實踐中閱讀更多詳細指南。
在極少數情況下,您的項目需要超過 30 個應用程序,您可以請求提高應用程序限制。您的項目必須採用 Blaze 定價計劃才能提出此請求。訪問 Google Cloud Console提出您的請求並對其進行評估。在 Google Cloud 文檔中詳細了解配額管理。
如果我將我的項目標記為“生產”環境會怎樣?
在 Firebase 控制台中,您可以使用環境類型標記您的 Firebase 項目,無論是生產環境還是未指定(非生產)環境。
將您的項目標記為環境類型不會影響您的 Firebase 項目的工作方式或其功能。但是,標記可以幫助您和您的團隊在應用程序生命週期內管理各種 Firebase 項目。
如果您將項目標記為生產環境,我們會在 Firebase 控制台中為項目添加顏色鮮豔的Prod標籤,提醒您任何更改都可能影響關聯的生產應用程序。將來,我們可能會為標記為生產環境的 Firebase 項目添加更多功能和保護措施。
要更改 Firebase 項目的環境類型,請轉至settings Project settings > General ,然後在Environment下的Your project卡中,單擊edit以更改環境類型。
在哪裡可以找到我的 Firebase 應用程序的應用程序 ID?
在 Firebase 控制台中,轉到您的settings項目設置。向下滾動到Your apps卡片,然後單擊所需的 Firebase 應用程序以查看該應用程序的信息,包括其App ID 。
以下是一些示例 App ID 值:
- Firebase iOS 應用:
1:1234567890:ios:321abc456def7890
- Firebase Android 應用程序:
1:1234567890:android:321abc456def7890
- Firebase 網絡應用:
1:1234567890:web:321abc456def7890
將 Google Play / AdMob / Google Ads / BigQuery 鏈接到我的 Firebase 項目或應用程序的先決條件是什麼?
- 要關聯您的Google Play 帳戶,您需要具備以下條件:
- 以下任一 Firebase 角色:所有者或 Firebase 管理員
和 - 以下任一 Google Play 訪問級別:帳戶所有者或管理員
- 以下任一 Firebase 角色:所有者或 Firebase 管理員
- 要關聯您的AdMob 應用,您需要同時是 Firebase 項目所有者和 AdMob 管理員。
- 要關聯您的AdWords 帳戶,您需要同時是 Firebase 項目所有者和 AdWords 管理員。
- 要鏈接您的BigQuery 項目,您需要是 Firebase 項目所有者。
我應該在我的應用程序中包含哪些開源聲明?
在 Apple 平台上,Firebase pod 包含一個 NOTICES 文件,其中包含相關條目。 Firebase Android SDK 包含一個用於顯示許可信息的輔助Activity
。
Firebase 項目的權限和訪問權限
如何為項目成員分配角色,例如所有者角色?
要管理分配給每個項目成員的角色,您必須是 Firebase 項目的所有者(或者被分配一個具有resourcemanager.projects.setIamPolicy
權限的角色)。
以下是您可以分配和管理角色的地方:
- Firebase 控制台提供了一種簡化的方法,可以在設置 >項目settings的用戶和權限選項卡中將角色分配給項目成員。在 Firebase 控制台中,您可以分配任何基本角色(所有者、編輯者、查看者)、 Firebase 管理員/查看者角色或任何Firebase 預定義產品類別角色。
- Google Cloud Console 提供了一組擴展工具,用於在IAM頁面中為項目成員分配角色。在 Cloud Console 中,您還可以創建和管理自定義角色,以及授予服務帳號訪問您的項目的權限。
請注意,在 Google Cloud Console 中,項目成員稱為principals 。
如果您項目的所有者無法再執行所有者的任務(例如,離開您公司的人)並且您的項目不是通過 Google Cloud 組織管理的(請參閱下一段),您可以聯繫 Firebase 支持以獲取指定的臨時所有者。
請注意,如果 Firebase 項目是 Google Cloud 組織的一部分,則它可能沒有所有者。如果您找不到 Firebase 項目的所有者,請聯繫管理您的 Google Cloud 組織的人員為項目分配所有者。
如何找到 Firebase 項目的所有者?
您可以在以下位置查看項目成員及其角色:
- 如果您有權訪問 Firebase 控制台中的項目,則可以在 Firebase 控制台的用戶和權限頁面中查看項目成員列表,包括所有者。
- 如果您無權訪問 Firebase 控制台中的項目,請檢查您是否有權訪問 Google Cloud Console 中的項目。您可以在 Google Cloud Console 的IAM頁面中查看項目成員列表,包括 Owner。
如果您項目的所有者無法再執行所有者的任務(例如,離開您公司的人)並且您的項目不是通過 Google Cloud 組織管理的(請參閱下一段),您可以聯繫 Firebase 支持以獲取指定的臨時所有者。
請注意,如果 Firebase 項目是 Google Cloud 組織的一部分,則它可能沒有所有者。相反,管理您的 Google Cloud 組織的人可以執行所有者可以執行的許多任務。但是,要執行多項特定於所有者的任務(如分配角色或管理 Google Analytics 屬性),管理員可能需要為自己分配實際的所有者角色來執行這些任務。如果您找不到 Firebase 項目的所有者,請聯繫管理您的 Google Cloud 組織的人員為項目分配所有者。
為什麼或何時應該為項目成員分配所有者角色?
為確保正確管理 Firebase 項目,它必須有一個Owner 。項目所有者是可以執行多項重要管理操作(例如分配角色和管理 Google Analytics 屬性)的人,而 Firebase 支持人員只能滿足已證明的項目所有者的管理請求。
為 Firebase 項目設置所有者後,請務必及時更新這些分配。
請注意,如果 Firebase 項目是 Google Cloud 組織的一部分,則管理您的 Google Cloud 組織的人員可以執行所有者可以執行的許多任務。但是,對於一些特定於所有者的任務(如分配角色或管理 Google Analytics 屬性),管理員可能需要為自己分配實際的所有者角色來執行這些任務。
我不認為我有一個 Firebase 項目,但我收到了一封關於一個的電子郵件。我如何訪問這個項目?
您收到的電子郵件應該包含一個鏈接,用於打開您的 Firebase 項目。單擊電子郵件中的鏈接應該會在 Firebase 控制台中打開該項目。
如果您無法打開鏈接中的項目,請確保您使用接收有關該項目的電子郵件的同一 Google 帳戶登錄 Firebase。您可以通過控制台右上角的帳戶頭像登錄和退出 Firebase 控制台。
請注意,如果您是 Google Cloud 組織的管理員,您可能會收到有關組織內 Firebase 項目更改的通知。但是,您可能沒有足夠的權限打開 Firebase 項目。在這些情況下,最簡單的解決方案是為自己分配實際所有者角色以打開項目並執行所需的操作。詳細了解分配所有者角色的原因和時間。
平台和框架
訪問特定於平台的故障排除和常見問題解答頁面,獲取有用的提示和更多常見問題解答的答案。
Firebase 控制台
訪問 Firebase 控制台支持哪些瀏覽器?
可以從最新版本的流行桌面瀏覽器(如 Chrome、Firefox、Safari 和 Edge)訪問 Firebase 控制台。目前不完全支持移動瀏覽器。
我可以加載 Firebase 控制台,但為什麼找不到或無法訪問我的 Firebase 項目?
如果您遇到以下任一問題,則此常見問題解答適用:
- Firebase 控制台返回一個錯誤頁面,指出您的項目可能不存在或您無權訪問該項目。
- 即使您在控制台的搜索字段中輸入項目 ID 或項目名稱,Firebase 控制台也不會顯示您的項目。
請嘗試以下故障排除步驟:
- 首先,嘗試通過直接訪問項目的 URL 來訪問您的項目。使用以下格式:
https://console.firebase.google.com/project/ PROJECT-ID /overview
- 如果您仍然無法訪問項目或收到權限錯誤,請檢查以下內容:
- 確保您使用有權訪問該項目的同一 Google 帳戶登錄 Firebase。您可以通過控制台右上角的帳戶頭像登錄和退出 Firebase 控制台。
- 確保為項目啟用了 Firebase Management API 。
- 確保為您分配了一種基本 IAM 角色(所有者、編輯者、查看者)或其中具有 Firebase 相關權限的角色,例如Firebase 預定義角色。您可以在 Google Cloud Console 的IAM頁面中查看您的角色。
- 如果您的項目屬於 Google Cloud 組織,您可能需要額外的權限才能查看 Firebase 控制台中列出的項目。聯繫管理您的 Google Cloud 組織的人員,以授予您查看項目的適當角色,例如瀏覽器角色。
如果上述故障排除步驟均無法讓您找到或訪問您的項目,請聯繫Firebase 支持。
為什麼 Firebase 控制台沒有為我加載?
如果您遇到以下任何問題,則此常見問題解答適用:
- Firebase 控制台中的頁面永遠不會完成加載。
- 頁面中的數據未按預期加載。
- 您在加載 Firebase 控制台時收到瀏覽器錯誤消息。
請嘗試以下故障排除步驟:
- 檢查Firebase 狀態儀表板的控制台行是否存在任何可能的服務中斷。
- 確保您使用的是受支持的瀏覽器。
- 嘗試在隱身或私人窗口中加載 Firebase 控制台。
- 禁用所有瀏覽器擴展。
- 確認網絡連接未被廣告攔截器、防病毒軟件、代理、防火牆或其他軟件阻止。
- 嘗試使用不同的網絡或設備加載 Firebase 控制台。
- 如果使用 Chrome,請檢查Developer Tools Console是否有任何錯誤。
如果上述問題排查步驟均無法解決問題,請聯繫Firebase 支持。
我的 Firebase 控制台語言是如何確定的?
Firebase 控制台的語言設置基於您在Google 帳戶設置中選擇的語言。
要更改您的語言首選項,請參閱更改語言。
Firebase 控制台支持以下語言:
- 英語
- 巴西葡萄牙語
- 法語
- 德語
- 印度尼西亞
- 日本人
- 韓國人
- 俄語
- 簡體中文
- 西班牙語
- 繁體中文
Firebase 控制台支持哪些角色和權限?
Firebase 控制台和 Google Cloud Console 使用相同的基礎角色和權限。在Firebase IAM 文檔中了解有關角色和權限的更多信息。
Firebase 支持 Owner、Editor 和 Viewer 的基本(基本)角色:
- 項目所有者可以將其他成員添加到項目中,設置集成(項目鏈接到 BigQuery 或 Slack 等服務),並擁有項目的完全編輯權限。
- 項目編輯器具有項目的完全編輯權限。
- 項目查看者只有項目的讀取權限。請注意,Firebase 控制台目前不會隱藏/禁用項目查看者的編輯 UI 控件,但對於分配有查看者角色的項目成員,這些操作將失敗。
Firebase 還支持:
- Firebase 預定義角色——精選的特定於 Firebase 的角色,與 Owner、Editor 和 Viewer 等基本角色相比,可以實現更精細的訪問控制。
- 自定義角色— 您創建的完全自定義的 IAM 角色,用於定制一組滿足組織特定要求的權限。
價錢
哪些產品是付費的?哪些是免費的?
Firebase 的付費基礎設施產品包括實時數據庫、Firebase 雲存儲、雲功能、託管、測試實驗室和電話身份驗證。我們為所有這些功能提供免費套餐。
Firebase 還有許多免費產品:Analytics、Cloud Messaging、Notifications composer、Remote Config、App Indexing、Dynamic Links 和 Crash Reporting。您可以在所有計劃中無限量使用這些產品中的任何一種,包括我們的免費 Spark 計劃。此外,除電話驗證之外的所有驗證功能都是免費的。
Firebase 是否為付費產品提供免費試用積分?
Firebase 付費服務可在谷歌云免費試用下使用。新的 Google Cloud 和 Firebase 用戶可以利用 90 天的試用期(包括 300 美元的免費 Cloud Billing 贈金)來探索和評估 Google Cloud 和 Firebase 產品和服務。
在 Google Cloud 免費試用期間,您將獲得一個免費試用 Cloud Billing 帳戶。任何使用該計費帳戶的 Firebase 項目都將在免費試用期內使用 Blaze 定價計劃。
別擔心,設置此免費試用 Cloud Billing 帳戶不會讓我們向您收費。除非您通過將免費試用 Cloud Billing 帳戶升級為付費帳戶來明確啟用計費,否則不會向您收費。您可以在試用期間隨時升級到付費帳戶。升級後,您仍然可以使用任何剩餘的積分(在 90 天內)。
免費試用期結束後,您需要將項目降級為 Spark 定價計劃或在 Firebase 控制台中設置 Blaze 定價計劃才能繼續使用您的 Firebase 項目。
了解有關Google Cloud 免費試用的更多信息。
我怎麼知道哪個定價計劃適合我?
星火定價計劃
我們的 Spark 計劃是免費開發應用程序的好地方。您可以獲得所有免費的 Firebase 功能(Analytics、Notifications composer、Crashlytics 等)和我們大量的付費基礎設施功能。但是,如果您在一個日曆月內超出了您的 Spark 計劃資源,您的應用程序將在該月的剩餘時間內關閉。此外,使用 Spark 計劃時無法使用 Google Cloud 功能。
大火定價計劃
我們的 Blaze 計劃專為生產應用程序而設計。 Blaze 計劃還允許您使用付費的 Google Cloud 功能擴展您的應用。您只需為消耗的資源付費,從而可以隨需擴展。我們努力使我們的 Blaze 計劃價格與行業領先的雲提供商競爭。
我如何監控我的使用情況和賬單?
您可以在以下任何儀表板上的 Firebase 控制台中跟踪項目資源的使用情況:
Flame 定價計劃發生了什麼變化?
2020 年 1 月,Flame 定價計劃(額外配額每月 25 美元)作為新註冊選項被刪除。現有計劃用戶獲得了寬限期,可以將他們的項目從 Flame 計劃中遷移出來。 2022 年 2 月,Flame 定價計劃的剩餘項目降級為 Spark 定價計劃。
因此,
- 現有的 Spark 和 Blaze 計劃項目以及任何新項目都不能再切換到或註冊 Flame 計劃。
- 如果您將現有的 Flame 計劃項目移至不同的定價計劃,則該項目無法返回到 Flame 計劃。
- 降級為 Spark 計劃的項目可以升級為 Blaze 計劃以恢復額外的付費服務。
- 對 Flame 計劃的引用已從文檔中刪除。
您對 Flame 計劃退休還有更多疑問嗎?閱讀下面的一些其他常見問題解答。
想了解 Firebase 提供的其他定價計劃嗎?訪問我們的Firebase 定價頁面!如果您想開始將任何現有項目轉移到另一個定價計劃,您可以在項目的Firebase 控制台中執行此操作。
有關 Flame 計劃停用的其他常見問題解答
我有一個依賴固定 Firebase 成本的項目、流程或業務模型。我應該怎麼辦?
註冊 Blaze 定價計劃,並確保設置預算提醒。
我是否可以獲得創建新的 Flame 計劃項目的特殊權限?
不,Firebase 不為項目提供特殊訪問權限以切換到或註冊 Flame 計劃。
我將我的 Flame 計劃項目更改為不同的定價計劃。我該如何改回來?
不再可能切換到 Flame 計劃。要訪問 Flame 計劃提供的服務,請確保您使用的是 Blaze 定價計劃,並考慮為您的項目設置預算提醒。
作為 Flame 計劃停用的一部分,我的項目自動切換到不同的定價計劃。我應該怎麼辦?
如果您的項目需要超出 Spark 計劃提供的額外配額,則需要將您的項目升級到 Blaze 定價計劃。
為什麼 Flame 計劃被淘汰?
多年來,我們看到 Flame 計劃的使用率在下降,而且大多數使用該計劃的項目都沒有充分發揮其價值。維持這種定價計劃通常不符合成本效益,我們認為,如果將資源用於其他 Firebase 計劃,我們可以更好地為每個人服務。
Blaze 計劃中的免費使用與 Spark 計劃中的免費使用有何不同?
Blaze 計劃的免費使用量每天計算一次。使用限制也不同於 Cloud Functions、電話身份驗證和測試實驗室的 Spark 計劃。
對於 Cloud Functions,Blaze 計劃的免費使用量是在 Cloud Billing 帳戶級別而不是項目級別計算的,並且具有以下限制:
- 200 萬次調用/月
- 400K GB 秒/月
- 200K CPU 秒/月
- 每月 5 GB 網絡出口
對於電話身份驗證,Blaze 計劃的免費使用量按月計算。
對於測試實驗室,Blaze 計劃的免費使用具有以下限制:
- 30 物理設備分鐘/天
- 60 虛擬設備分鐘/天
當我從 Spark 計劃更改為 Blaze 計劃時,免費使用配額是否會重置?
Blaze 計劃中包含 Spark 計劃的免費使用。轉移到 Blaze 計劃時,免費使用不會重置。
什麼是“同步數據庫連接”?
同時連接相當於連接到數據庫的一個移動設備、瀏覽器選項卡或服務器應用程序。 Firebase 對應用程序數據庫的同時連接數施加了硬性限制。這些限制旨在保護 Firebase 和我們的用戶免受濫用。
Spark 計劃限制為 100,無法提高。 Flame 和 Blaze 計劃限制每個數據庫 200,000 個並發連接。
此限制與您的應用程序的用戶總數不同,因為您的用戶不會同時連接。如果您需要超過 200,000 個同時連接,請閱讀擴展多個數據庫。
如果我超過實時數據庫的 Spark 計劃存儲或下載限制會怎樣?
為了向您提供可預測的價格,Spark 計劃中您可用的資源是有上限的。這意味著當您在任何月份超過任何計劃限制時,您的應用程序將被關閉以防止進一步使用資源和產生額外費用。
如果我超過實時數據庫的 Spark 計劃同時連接限制會怎樣?
當您的應用程序達到 Spark 計劃的並發限制時,任何後續連接都將被拒絕,直到某些現有連接被關閉。該應用程序將繼續為連接的用戶工作。
如果我超過雲存儲的 Spark 計劃上傳、下載或存儲限制會怎樣?
當您超過 Spark 計劃項目中的 Cloud Storage 限制時,結果取決於您超出的限制類型:
- 如果超過GB 存儲限制,您將無法在該項目中存儲更多數據,除非您刪除部分存儲數據或升級到提供更多存儲空間或無限存儲空間的計劃。
- 如果您超過GB 下載限制,您的應用將無法在第二天(美國太平洋時間午夜開始)之前下載更多數據,除非您升級到限制較少或沒有限制的計劃。
- 如果您超過上傳或下載操作限制,您的應用將無法上傳或下載更多數據,直到第二天(美國太平洋時間午夜開始),除非您升級到限制較少的計劃,或者沒有限制。
Firebase 與 Google Cloud 的集成如何運作?
Firebase 與穀歌云深度集成。項目在 Firebase 和 Google Cloud 之間共享,因此項目可以啟用 Firebase 服務和 Google Cloud 服務。您可以從 Firebase 控制台或 Google Cloud Console 訪問同一項目。具體來說:
- 某些 Firebase 產品直接由 Google Cloud 提供支持,例如 Cloud Storage for Firebase。隨著時間的推移,谷歌云支持的產品列表將繼續增長。
- 您的許多設置(包括協作者和結算信息)都由 Firebase 和 Google Cloud 共享。您對 Firebase 和 Google Cloud 的使用出現在同一張賬單上。
此外,升級到 Blaze 計劃後,您可以直接在 Firebase 項目中使用 Google Cloud 的任何世界級基礎設施即服務和 API,價格為標準Google Cloud 定價。您還可以將數據從 Google Cloud 直接導出到 BigQuery 進行分析。要了解更多信息,請參閱將 BigQuery 與 Firebase 相關聯。
將 Google Cloud 與 Firebase 結合使用(與其他不在同一地點的雲服務相比)有許多增強安全性、改善延遲和節省時間的好處。查看Google Cloud 站點了解更多詳細信息。
如果我在 Google Cloud Console 中為該項目添加或刪除結算帳戶,我的 Firebase 項目會怎樣?
如果將 Cloud Billing 帳戶添加到 Google Cloud Console 中的項目,如果該項目當前在 Spark 計劃中,則該項目將自動升級到 Firebase Blaze 計劃。
相反,如果從 Google Cloud Console 中的項目中刪除現有的活動 Cloud Billing 帳戶,則該項目將降級為 Firebase Spark 計劃。
我可以隨時升級、降級或取消嗎?
是的,您可以隨時升級、降級或取消。請注意,我們不為降級或取消提供按比例退款。這意味著,如果您在結算期結束前降級或取消,您仍需支付當月剩餘時間的費用。
我會得到什麼樣的支持?
所有 Firebase 應用程序,包括那些使用免費計劃的應用程序,都在美國太平洋地區的工作時間內提供來自 Firebase 員工的電子郵件支持。 All accounts have unlimited support for billing-related issues, account-related issues, technical (troubleshooting) questions, and incident reports.
Can I cap usage on the Blaze plan?
No, you cannot currently cap your Blaze plan usage. We are evaluating options for supporting caps on Blaze plan usage.
Blaze users can define a budget for their project or account, and receive alerts as their spending approaches those limits. Learn how to set up budget alerts .
What are automated backups? Do you offer hourly backups?
Automated backups are an advanced feature for customers on our Blaze pricing plan that backs up your Firebase Realtime Database data once a day and uploads it to Google Cloud Storage .
We do not offer hourly backups.
Do you offer open-source, nonprofit, or educational discounts?
Our Spark plan can be used by any type of individual or organization, including nonprofits, schools, and open-source projects. Since these plans already include generous quotas, we don't offer any special discounts or plans for open-source, nonprofit, or educational projects.
Do you offer enterprise contracts, pricing, support, or dedicated infrastructure hosting?
Our Blaze plan is suitable for enterprises of all sizes, and our SLA meets or exceeds the industry standard for cloud infrastructure. However, we do not currently offer enterprise contracts, pricing, or support, nor do we offer dedicated infrastructure hosting (that is, on-premises installations) for services like our Realtime Database. We are hard at work adding some of these features.
Do you offer ad-hoc pricing? I only want pay-as-you-go for one or two features.
We offer ad-hoc pricing in the Blaze plan, where you pay only for the features you use.
How do the paid Firebase plans work with Ads? Are there no-cost advertising credits with paid plans?
The Firebase pricing plans are separate from Ads, so there are no advertising credits without cost. As a Firebase developer, you are able to "link" your Ads account to Firebase to support conversion tracking.
All ads campaigns are managed directly in Ads, and Ads billing is managed from the Ads console.
Cloud Functions pricing
Why do I need a billing account to use Cloud Functions for Firebase?
Cloud Functions for Firebase relies on some paid Google services. New function deployments with Firebase CLI 11.2.0 and higher rely on Cloud Build and Artifact Registry . Deployments to older versions use Cloud Build in the same way, but rely on Container Registry and Cloud Storage for storage instead of Artifact Registry. Usage of these services will be billed in addition to existing pricing.
Storage space for Firebase CLI 11.2.0 and newer versions
Artifact Registry provides the containers in which functions run. Artifact Registry provides the first 500MB at no cost, so your first function deployments may not incur any fees. Above that threshold, each additional GB of storage is billed at $0.10 per month.
Storage space for Firebase CLI 11.1.x and prior versions
For functions deployed to older versions, Container Registry , provides the containers in which functions run. You'll be billed for each container required to deploy a function. You may notice small charges for each container stored—for example, 1GB of storage is billed at $0.026 per month .
To understand more about how your bill might change, please review the following
- Cloud Functions pricing : existing no-cost tier is unchanged.
- Cloud Build pricing: Cloud Build provides for a no-cost tier.
- Artifact Registry pricing .
- Container Registry pricing .
Does Cloud Functions for Firebase still have no-cost usage?
Yes. On the Blaze plan, Cloud Functions provides a no-cost tier for invocations, compute time, and internet traffic. The first 2,000,000 invocations, 400,000 GB-sec, 200,000 CPU-sec, and 5 GB of Internet egress traffic is provided at no cost each month. You'll be charged only for usage above those thresholds.
After the first 500MB of no-cost storage, each deployment operation will incur small-scale charges for the storage space used for the function's container. If your development process depends on deploying functions for testing, you can further minimize costs by using the Firebase Local Emulator Suite during development.
See Firebase Pricing plans and the Cloud Functions Pricing example scenarios.
Is Firebase planning to raise the quotas and limits for Cloud Functions for Firebase?
No. There are no plans to change the quotas except for the removal of a maximum build time limit; instead of receiving errors or warnings when the daily build quota of 120 minutes is reached, you'll be billed under the terms of the Blaze pricing plan. See Quotas and limits .
Can I get the Google Cloud $300 credit?
Yes, you can create a Cloud Billing account in the Google Cloud Console to get the $300 credit, then link that Cloud Billing account to a Firebase project.
More about the Google Cloud credit here .
Note that if you do this, you have to then set up the Blaze pricing plan in the Firebase console in order for your project to continue working after the $300 credit is exhausted.
I want to follow a codelab to learn about Firebase. Can you give me a temporary billing account?
No, sorry. You can use the Firebase emulator for development without having a Cloud Billing account. Alternatively, try applying for a Google Cloud free trial . If you're still having trouble paying your bill because of this change, contact Firebase Support.
I'm worried I'm going to rack up a huge bill.
You can set up budget alerts in the Google Cloud Console to help control costs. Also, you can set limits on the number of billed instances created for each of your functions. To get an idea of costing for typical scenarios, see the Cloud Functions Pricing examples.
How can I check my current billing charges?
View the Usage and billing dashboard in the Firebase console.
I use Firebase Extensions. Do I need a billing account?
Yes. Since extensions use Cloud Functions , extensions will be subject to the same charges as other functions.
To use extensions, you will need to upgrade to the Blaze pricing plan. You will be charged a small amount (typically around $0.01 per month for the Firebase resources required by each extension you install (even if they are not used), in addition to any charges associated with your use of Firebase services.
Privacy
Where can I find information about privacy and security in Firebase?
Check out the page Privacy and Security in Firebase .
Do the Firebase SDKs log any usage/diagnostic information outside of Analytics?
Yes. This is currently iOS-only, but may change in the future. The Firebase Apple platforms SDK includes the FirebaseCoreDiagnostics
framework by default. This framework is used by Firebase to collect SDK usage and diagnostics information to help prioritize future product enhancements. FirebaseCoreDiagnostics
is optional, so if you would like to opt out of sending Firebase diagnostic logs, you can do so by unlinking the library from your application. You can browse the full source, including logged values, on GitHub
A/B 測試
A/B Testing: How many experiments can I create and run?
You are allowed up to 300 experiments per project, which could consist of up to 24 running experiments, with the rest as draft or completed.
A/B Testing: Why can't I view my experiments after unlinking and re-linking my project to Google Analytics?
Linking to a different Google Analytics property will cause you to lose access to experiments created beforehand. To regain access to a previous experiment, re-link your project to the Google Analytics property that was linked when the experiment was created.
AdMob
AdMob: Can I link my Windows apps to Firebase?
No, Windows apps are not currently supported.
AdMob: Why can't I link my app to AdMob from the Firebase console?
You can link an AdMob app to a Firebase app via the AdMob console. Learn how.
AdMob: What permissions or access do I need to link a Firebase app to an AdMob app?
In order to do this linking, you need the following access:
- AdMob : You need to be an AdMob admin.
- Firebase : You must have the
firebase.links.create
permission, which is included in the Owner role and the Firebase Admin role . - Google Analytics : You must have the Edit role or Manage Users role for the property associated with the Firebase project. Learn more.
AdMob: Can multiple users in the same AdMob account link AdMob apps and Firebase apps?
For multi-user AdMob accounts , the user who created the first Firebase link and accepted the Firebase Terms of Service is the only user who can create new links between AdMob apps and Firebase apps.
AdMob: To use AdMob, should I use the Firebase SDK for AdMob or the Google Mobile Ads SDK?
- For iOS projects , use the Google Mobile Ads SDK:
pod 'Google-Mobile-Ads-SDK'
- For Android projects , use the Google Mobile Ads SDK:
implementation 'com.google.android.gms:play-services-ads:21.5.0'
Note that the Firebase Android SDKs for AdMob transitively include the Firebase SDK for Google Analytics. So, if your app calls any Google Analytics APIs and you switch to using the Google Mobile Ads SDK, make sure that you explicitly add the dependency for the Firebase SDK for Google Analytics (
) to your app'scom.google.firebase:firebase-analytics build.gradle
file. - For C++ projects and Unity projects , follow the instructions in the respective documentation.
分析
Analytics: Why is Google Analytics a recommended part of using Firebase products?
Google Analytics is a free and unlimited analytics solution that works with Firebase features to deliver powerful insights. It enables you to view event logs in Crashlytics, notification effectiveness in FCM, deep link performance for Dynamic Links, and in-app purchase data from Google Play. It powers advanced audience targeting in Remote Config, Remote Config personalization, and more.
Google Analytics acts as a layer of intelligence in the Firebase console to provide you with more actionable insights about how to develop a high quality app, grow your user base, and earn more money.
To get started, read the documentation .
Analytics: How do I control how my Analytics data is shared with the rest of Firebase?
By default, your Google Analytics data is used to enhance other Firebase and Google features. You can control how your Google Analytics data is shared in your project settings anytime. Learn more about Data sharing settings .
Analytics in my iOS app: Can I install Analytics without ad attribution and IDFA collection features?
Yes. See the Configure Data Collection and Usage page for more details.
Analytics: Why don't I see any data after unlinking my app from Google Analytics?
Your analytics data resides within the Google Analytics property - not within the Firebase project. If you delete or unlink the property, then your data is unlinked from your project as well. The data still resides in that property, however, and you can always relink it to your project.
Creating a new Google Analytics account (and new property) will result in having a blank analytics dashboard in the Firebase console.
Analytics: How do I segment users who have not met some criterion?
You can reframe the problem by "negatively targeting" these users. For example, reframe the problem as "Don't show ads to people who have bought something", and form an audience of those users to target.
Analytics: Are audiences and/or events defined in the Google Analytics interface also available in the Firebase console?
Your audiences and user properties will be synced. For some features, you'll need to use the Google Analytics interface, such as segmentation and closed funnels. You can access the Google Analytics interface directly via deep-links from the Firebase console.
Any changes you make from the Firebase console can also be performed in Google Analytics, and those changes will be reflected in Firebase.
Analytics: What changed in the Google Analytics section with the October 2021 update?
You can find a summary of these changes in the Firebase Help Center article New Google Analytics 4 functionality in Google Analytics for Firebase .
Upgrading your Analytics property
Analytics: What is the new fully upgraded Google Analytics account?
You can read more about the new Google Analytics upgrade in our blog post .
Analytics: How do I know if I'm using Google Analytics for Firebase or a fully upgraded Google Analytics account?
If you see a link to "View your data in Google Analytics" from the analytics dashboard in the Firebase console, then your project is using a fully upgraded Google Analytics account.
You can also check by viewing the Google Analytics card in the Firebase console (you can access this from settings > Project Settings > Integrations , then click Manage ). If you see a Linked Google Analytics account listed in the Your Google Analytics property section, your project is using the full Google Analytics experience in Firebase. If you do not see a Linked Google Analytics account , your project is using Google Analytics for Firebase.
Analytics: When must I upgrade my Google Analytics for Firebase property to retain service?
Any Firebase project created before July 31, 2019 must be upgraded to the full Google Analytics 4 experience if it hasn't already. (Banners display in the Analytics dashboard if an upgrade is required.) The associated Terms of Service must be accepted by February 15, 2022 to ensure data collection continues and by March 15, 2022 to prevent the deletion of the Analytics property and its data. If you no longer want to use Google Analytics and the associated data, no action is required and the property will be deleted on March 15, 2022.
Failure to accept the new Google Analytics Terms of Service will disrupt Firebase features, including Crash-Free Users (Crashlytics), targeted Configurations and Remote Config personalization, A/B Testing features, Targeting and Campaign Metrics (Cloud Messaging). It will also disrupt Google Analytics for Firebase Integrations , including Exporting project data to BigQuery , Google Ads Integrations , and AdMob Integrations .
If you have questions about accessing your Firebase project, including finding or assigning an Owner, review the Permissions and access to Firebase projects FAQs .
Analytics: What will happen to my data when I upgrade to the new Google Analytics for Firebase?
This will not affect your existing Firebase project analytics data in the Firebase console.
You will be able to continue using the same dashboard and workflows you are using today, and you will also have access to some advanced features in Google Analytics.
Note that if you decide to enable cross-device reporting after making the upgrade, your data will be de-duplicated using the UserID. This may decrease some user counts in the Firebase console.
Analytics: Why do I get an error when trying to upgrade my project to the new Google Analytics experience?
If you are experiencing an error when upgrading, such as:
The operation has failed (Reason: Requested entity already exists)
或者
The operation has failed (Reason: Precondition check failed)
This means that there is an association between your project and an already existing Google Analytics property. You can unlink the property, delete it, or upgrade through the Google Analytics interface.
If this is still an issue, you can use the REST API to unlink by using the removeAnalytics
method , then use the addGoogleAnalytics
method to link a new property.
You can then move the data from one property to another .
驗證
Firebase Authentication: Which countries are supported for phone authentication?
Firebase Authentication supports phone number verification across the the world, but not all networks reliably deliver our verification messages. The following countries have good rates of delivery, and should be expected to work well for phone number sign in.
Country | Code |
---|---|
AD | Andorra |
AE | United Arab Emirates |
AF | Afghanistan |
AG | Antigua and Barbuda |
AL | Albania |
AM | Armenia |
AO | Angola |
AR | Argentina |
AS | American Samoa |
AT | Austria |
AU | Australia |
AW | Aruba |
AZ | Azerbaijan |
BA | Bosnia and Herzegovina |
BB | Barbados |
BD | Bangladesh |
BE | Belgium |
BF | Burkina Faso |
BG | Bulgaria |
BJ | Benin |
BM | Bermuda |
BN | Brunei Darussalam |
BO | Bolivia |
BR | Brazil |
BS | Bahamas |
BT | Bhutan |
BW | Botswana |
BY | Belarus |
BZ | Belize |
CA | Canada |
CD | Congo, (Kinshasa) |
CF | Central African Republic |
CG | Congo (Brazzaville) |
CH | Switzerland |
CI | Côte d'Ivoire |
CK | Cook Islands |
CL | Chile |
CM | Cameroon |
CO | Colombia |
CR | Costa Rica |
CV | Cape Verde |
CW | Curaçao |
CY | Cyprus |
CZ | Czech Republic |
DE | Germany |
DJ | Djibouti |
DK | Denmark |
DM | Dominica |
DO | Dominican Republic |
DZ | Algeria |
EC | Ecuador |
EG | Egypt |
ES | Spain |
ET | Ethiopia |
FI | Finland |
FJ | Fiji |
FK | Falkland Islands (Malvinas) |
FM | Micronesia, Federated States of |
FO | Faroe Islands |
FR | France |
GA | Gabon |
GB | United Kingdom |
GD | Grenada |
GE | Georgia |
GF | French Guiana |
GG | Guernsey |
GH | Ghana |
GI | Gibraltar |
GL | Greenland |
GM | Gambia |
GP | Guadeloupe |
GQ | Equatorial Guinea |
GR | Greece |
GT | Guatemala |
GY | Guyana |
HK | Hong Kong, SAR China |
HN | Honduras |
HR | Croatia |
HT | Haiti |
HU | Hungary |
ID | Indonesia |
IE | Ireland |
IL | Israel |
IM | Isle of Man |
IN | India |
IQ | Iraq |
IT | Italy |
JE | Jersey |
JM | Jamaica |
JO | Jordan |
JP | Japan |
KE | Kenya |
KG | Kyrgyzstan |
KH | Cambodia |
KM | Comoros |
KN | Saint Kitts and Nevis |
KR | Korea (South) |
KW | Kuwait |
KY | Cayman Islands |
KZ | Kazakhstan |
LA | Lao PDR |
LB | Lebanon |
LC | Saint Lucia |
LI | Liechtenstein |
LK | Sri Lanka |
LS | Lesotho |
LT | Lithuania |
LU | Luxembourg |
LV | Latvia |
LY | Libya |
MA | Morocco |
MD | Moldova |
ME | Montenegro |
MF | Saint-Martin (French part) |
MG | Madagascar |
MK | Macedonia, Republic of |
MM | Myanmar |
MN | Mongolia |
MO | Macao, SAR China |
MS | Montserrat |
MT | Malta |
MU | Mauritius |
MW | Malawi |
MX | Mexico |
MY | Malaysia |
MZ | Mozambique |
NA | Namibia |
NC | New Caledonia |
NE | Niger |
NF | Norfolk Island |
NG | Nigeria |
NI | Nicaragua |
NL | Netherlands |
NO | Norway |
NP | Nepal |
NZ | New Zealand |
OM | Oman |
PA | Panama |
PE | Peru |
PG | Papua New Guinea |
PH | Philippines |
PK | Pakistan |
PL | Poland |
PM | Saint Pierre and Miquelon |
PR | Puerto Rico |
PS | Palestinian Territory |
PT | Portugal |
PY | Paraguay |
QA | Qatar |
RE | Réunion |
RO | Romania |
RS | Serbia |
RU | Russian Federation |
RW | Rwanda |
SA | Saudi Arabia |
SC | Seychelles |
SE | Sweden |
SG | Singapore |
SH | Saint Helena |
SI | Slovenia |
SK | Slovakia |
SL | Sierra Leone |
SN | Senegal |
SR | Suriname |
ST | Sao Tome and Principe |
SV | El Salvador |
SZ | Swaziland |
TC | Turks and Caicos Islands |
TG | Togo |
TH | Thailand |
TL | Timor-Leste |
TM | Turkmenistan |
TO | Tonga |
TR | Turkey |
TT | Trinidad and Tobago |
TW | Taiwan, Republic of China |
TZ | Tanzania, United Republic of |
UA | Ukraine |
UG | Uganda |
US | United States of America |
UY | Uruguay |
UZ | Uzbekistan |
VC | Saint Vincent and Grenadines |
VE | Venezuela (Bolivarian Republic) |
VG | British Virgin Islands |
VI | Virgin Islands, US |
VN | Viet Nam |
WS | Samoa |
YE | Yemen |
YT | Mayotte |
ZA | South Africa |
ZM | Zambia |
ZW | Zimbabwe |
雲端功能
Cloud Functions runtime support
How do I upgrade to the latest supported version of Node.js?
- Make sure you're on the Blaze pricing plan .
- Make sure you are using the latest version of the Firebase CLI.
- Update the
engines
field in your functions'package.json
. - Optionally, test your changes using the Firebase Local Emulator Suite .
- Redeploy all functions.
How can I make sure I deployed my functions to a specific Node.js runtime?
In the Firebase console, go to the functions dashboard , select a function, and check the function's language under Additional details .
I use Firebase Extensions. Will I be affected by Cloud Functions runtime updates?
Yes. Since extensions use Cloud Functions , the runtime of your extensions will need to be updated on the same timeline as Cloud Functions.
We recommend that you periodically update to the latest version of each extension installed in your project. You can upgrade your projects' extensions via the Firebase console or Firebase CLI .
雲消息
Cloud Messaging: What's the difference between the Notifications composer and Cloud Messaging?
Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.
The Notifications composer is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, the Notifications composer lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns.
Capabilities | Notifications composer | Cloud Messaging | |
---|---|---|---|
Target | Single device | ||
Clients subscribed to topics (ie weather) | |||
Clients in predefined user segment (app, version, language) | |||
Clients in specified analytics audiences | |||
Clients in device groups | |||
Upstream from client to server | |||
Message Type | Notifications up to 2kb | ||
Data messages up to 4kb | |||
Delivery | Immediate | ||
Future client device local time | |||
Analytics | Built-in Notifications analytics collection and funnel analytics |
Cloud Messaging: Apple announced they're deprecating the legacy binary protocol for APNs. Do I need to do anything?
No. Firebase Cloud Messaging switched to the HTTP/2-based APNs protocol in 2017. If you are using FCM to send notifications to iOS devices, there should be no action required on your part.
Cloud Messaging: Do I need to use other Firebase services in order to use FCM?
You can use Firebase Cloud Messaging as a standalone component, in the same manner as you did with GCM, without using other Firebase services.
Cloud Messaging: I am an existing Google Cloud Messaging (GCM) developer. Should I move to Firebase Cloud Messaging?
FCM is the new version of GCM under the Firebase brand. It inherits GCM's core infrastructure, with new SDKs to make Cloud Messaging development easier.
Benefits of upgrading to FCM SDK include:
- Simpler client development. You no longer have to write your own registration or subscription retry logic.
- An out-of-the-box notification solution. You can use the Notifications composer, a serverless notifications solution with a web console that lets anyone send notifications to target specific audiences based on insights from Google Analytics for Firebase.
To upgrade from GCM SDKs to FCM SDKs, see the guides for migrating Android and iOS apps.
Cloud Messaging: Why do my targeted devices apparently fail to receive messages?
When it looks like devices haven't successfully received messages, check first for these two potential causes:
Foreground message handling for notification messages . Client apps need to add message handling logic to handle notification messages when the app is in the foreground on the device. See the details for iOS and Android .
Network firewall restrictions . If your organization has a firewall that restricts the traffic to or from the Internet, you need to configure it to allow connectivity with FCM in order for your Firebase Cloud Messaging client apps to receive messages. The ports to open are:
- 5228
- 5229
- 5230
FCM usually uses 5228, but it sometimes uses 5229 and 5230. FCM does not provide specific IPs, so you should allow your firewall to accept outgoing connections to all IP addresses contained in the IP blocks listed in Google's ASN of 15169 .
Cloud Messaging: I have implemented onMessageReceived
in my Android app, but it is not being called.
When your app is in the background, notification messages are displayed in the system tray, and onMessageReceived
is not called. For notification messages with a data payload, the notification message is displayed in the system tray, and the data that was included with the notification message can be retrieved from the intent launched when the user taps on the notification.
For more information, see Receive and handle messages .
Notifications composer: What's the difference between the Notifications composer and Cloud Messaging?
The Notifications composer is a lightweight, serverless messaging solution built on Firebase Cloud Messaging. With a user-friendly graphical console and reduced coding requirements, the Notifications composer lets users easily send messages to reengage and retain users, foster app growth, and support marketing campaigns.
Firebase Cloud Messaging provides a complete set of messaging capabilities through its client SDKs and HTTP and XMPP server protocols. For deployments with more complex messaging requirements, FCM is the right choice.
Here's a comparison of the messaging capabilities provided by Firebase Cloud Messaging and the Notifications composer:
Capabilities | Notifications composer | Cloud Messaging | |
---|---|---|---|
Target | Single device | ||
Clients subscribed to topics (ie weather) | |||
Clients in predefined user segment (app, version, language) | |||
Clients in specified analytics audiences | |||
Clients in device groups | |||
Upstream from client to server | |||
Message Type | Notifications up to 2kb | ||
Data messages up to 4kb | |||
Delivery | Immediate | ||
Future client device local time | |||
Analytics | Built-in Notifications analytics collection and funnel analytics |
Notifications composer: I am an existing Google Cloud Messaging (GCM) developer, and I want to use the Notifications composer. What should I do?
The Notifications composer is an out-of-the-box solution that lets anyone send notifications to target specific audiences based on insights from Google Analytics for Firebase. Also, the Notifications composer provides funnel analysis for every message, allowing easy evaluation of notification effectiveness.
If you are an existing GCM developer, to use the Notifications composer you have to upgrade from GCM SDKs to FCM SDKs. See the guides for migrating Android and iOS apps.
用於 Firebase 的雲存儲
Cloud Storage for Firebase: Why can't I use Cloud Storage for Firebase?
Cloud Storage for Firebase creates a default bucket in the App Engine no-cost tier. This allows you to quickly get up and running with Firebase and Cloud Storage for Firebase, without having to put in a credit card or enable a Cloud Billing account. It also allows you to easily share data between Firebase and a Google Cloud project.
There are, however, two known cases where this bucket cannot be created and you will be unable to use Cloud Storage for Firebase:
- A project imported from Google Cloud which had a App Engine Master/Slave Datastore application.
- A project imported from Google Cloud which has domain prefixed projects. For example:
domain.com:project-1234
.
There are currently no workarounds to these issues, and we recommend that you create a new project in the Firebase console and enable Cloud Storage for Firebase in that project.
Cloud Storage for Firebase: Why do I get error code 412 responses about service account permissions and failed service account operations when using the Cloud Storage for Firebase API?
It's likely you're getting 412 error codes either because the Cloud Storage for Firebase API is not enabled for your project or a necessary service account is missing the required permissions.
See the related FAQ .
Cloud Storage for Firebase: Why do I see new service account IDs associated with my Firebase projects that use Cloud Storage for Firebase?
Firebase uses service accounts to operate and manage services without sharing user credentials. When you create a Firebase project, you might notice that a number of service accounts are already available in your project.
The service account that Cloud Storage for Firebase uses is scoped to your project and is named
service- PROJECT_NUMBER @gcp-sa-firebasestorage.iam.gserviceaccount.com
.
If you used Cloud Storage for Firebase before September 19, 2022, you may see an additional service account on previously-linked Cloud Storage buckets named firebase-storage@system.gserviceaccount.com
. As of September 19, 2022, this service account is no longer supported.
You can view all service accounts associated with your project in the Firebase console, on the Service accounts tab .
Adding the new service account
If you removed the service account previously or the service account is not present in your project, you may do one of the following to add the account.
- (Recommended) Automated: Use the AddFirebase REST endpoint to re-import your bucket into Firebase. You will only need to call this endpoint once, not once for each linked bucket.
- Manual: Follow the steps in Creating and managing service accounts . Following that guide, add a service account with the IAM role
Cloud Storage for Firebase Service Agent
, and service account name
service- PROJECT_NUMBER @gcp-sa-firebasestorage.iam.gserviceaccount.com
.
Removing the new service account
We strongly discourage you from removing the service account because this may block access to your Cloud Storage buckets from your apps. To remove the service account from your project, follow the instructions in Disabling a service account .
崩潰分析
Visit the Crashlytics troubleshooting & FAQ page for helpful tips and answers to more FAQs.
動態鏈接
Dynamic Links: Why does my Android app access each Dynamic Link twice?
The getInvitation
API clears the saved Dynamic Link to prevent it from being accessed twice. Be sure to call this API with the autoLaunchDeepLink
parameter set to false
in each of the deep link activities to clear it for the case when the activity is triggered outside the main activity.
Firebase Local Emulator Suite
Why do Emulator Suite logs show an error starting with "Multiple projectIds are not recommended in single project mode"?
This message means the Emulator Suite has detected it may be running a particular product emulator using different project IDs. This may indicate a misconfiguration, and can cause issues when emulators try to communicate with one another, and when you try to interact with emulators from your code. If project IDs don't match, it often appears that data is missing, since data stored in emulators is keyed to projectID, and interoperability depends on matching project IDs.
This has been a common source of confusion among developers, so by default the Local Emulator Suite will now only allow running with a single project ID, unless you specify otherwise in the firebase.json
configuration file. If an emulator detects more than one project ID, it will log a warning and potentially throw a fatal error.
Check your project ID declaration(s) for mismatches in:
- The default project set at the command line. By default, the project ID will be taken on startup from the project selected with
firebase init
orfirebase use
. To view the list of projects (and see which one is selected) usefirebase projects:list
. - Unit tests. The project ID is often specified in calls to the Rules Unit Testing library methods
initializeTestEnvironment
orinitializeTestApp
. Other testing code may initialize withinitializeApp(config)
. - The command line
--project
flag. Passing the Firebase CLI--project
flag overrides the default project. You'll need to ensure the value of the flag matches the project ID in unit tests and app initialization.
Platform-specific places to check:
Web | The projectId property in your JavaScript firebaseConfig object, used in initializeApp . |
安卓 | The project_id property inside the google-services.json configuration file. |
Apple platforms | The PROJECT_ID property in the GoogleService-Info.plist configuration file. |
To disable single project mode, update firebase.json
with the singleProjectMode
key:
{ "firestore": { ... }, "functions": { ... }, "hosting": { ... }, "emulators": { "singleProjectMode": false, "auth": { "port": 9099 }, "functions": { "port": 5001 }, ... } }
Hosting
Hosting: Why does my Hosting release history table in the Firebase console show file counts that are more than what my local project actually has?
Firebase automatically adds extra files containing metadata about the Hosting site, and these files are included in the total file count for the release.
Hosting: What's the largest file size that I can deploy to Firebase Hosting?
Hosting has a maximum size limit of 2 GB for individual files.
We recommend storing larger files using Cloud Storage , which offers a maximum size limit in the terabyte range for individual objects.
Hosting: How many Hosting sites can I have per Firebase project?
The Firebase Hosting multisite feature supports a maximum of 36 sites per project.
性能監控
Visit the Performance Monitoring troubleshooting & FAQ page for helpful tips and answers to more FAQs.
Performance Monitoring: How many custom URL patterns can I create?
You can create up to 400 total custom URL patterns per app and up to 100 custom URL patterns per domain for that app.
Performance Monitoring: Why am I not seeing real time display of performance data?
To view real time performance data, make sure that your app uses a Performance Monitoring SDK version that's compatible with real time data processing.
- iOS — v7.3.0 or later
- tvOS — v8.9.0 or later
- Android — v19.0.10 or later (or Firebase Android BoM v26.1.0 or later)
- Web — v7.14.0 or later
Note that we always recommend using the latest version of SDK, but any version listed above will enable Performance Monitoring to process your data in near real time.
實時數據庫
Realtime Database: Why was my Realtime Database reported bandwidth lower than average between September 2016 and March 2017?
For our bandwidth calculations, we normally include SSL encryption overhead (based on layer 5 of the OSI model). However, in September 2016, we introduced a bug that caused our bandwidth reporting to ignore encryption overhead. This might have resulted in artificially low reported bandwidth and bills on your account for a few months.
We released a fix for the bug in late March 2017, returning bandwidth reporting and billing to their normal levels.
Realtime Database: What are the scaling limitations of the Realtime Database?
Each Realtime Database instance has limits on the number of write operations per second. For small writes, this limit is approximately 1000 write operations per second. If you are approaching this limit, batching operations using multi-path updates can help you achieve higher throughput.
In addition, each database instance has a cap on the number of simultaneous database connections . Our default limits are large enough for most applications. If you are building an app that requires additional scale, you may need to shard your application across multiple database instances for added scale. You may also consider Cloud Firestore as an alternative database.
Realtime Database: What can I do if I'm over my Realtime Database usage limits?
If you've received an email alert or notification in the Firebase console that you've exceeded your Realtime Database usage limits, you can address it based on the usage limit you've exceeded. To see your Realtime Database usage, go to the Realtime Database Usage dashboard in the Firebase console.
If you're over your download limit, you can upgrade your Firebase pricing plan or wait until your download limit resets at the start of your next billing cycle. To decrease your downloads, try the following steps:
- Add queries to limit the data that your listen operations return.
- Check for unindexed queries.
- Use listeners that only download updates to data — for example,
on()
instead ofonce()
. - Use security rules to block unauthorized downloads.
If you're over your storage limit, upgrade your pricing plan to avoid service disruptions. To reduce the amount of data in your database, try the following steps:
- Run periodic cleanup jobs.
- Reduce any duplicate data in your database.
Note that it may take some time to see any data deletions reflected in your storage allotment.
If you're over your simultaneous database connections limit, upgrade your plan to avoid any service disruptions. To manage simultaneous connections to your database, try connecting via users via the REST API if they don't require a realtime connection.
遠程配置
Remote Config: Why don't fetched values change the behavior and appearance of my app?
Unless you fetch values with fetchAndActivate()
, values are stored locally but not activated. To activate fetched values so that they can take effect, call activate
. This design lets you control when the behavior and appearance of your app changes, because you can choose when to call activate
. After you call activate
, your app source code determines when updated parameter values are used.
For example, you could fetch values and then activate them the next time a user starts your app, which removes the need to delay app startup while your app waits for fetched values from the service. Changes to your app's behavior and appearance then occur when your app uses the updated parameter values.
To learn more about the Remote Config API and usage model, see Remote Config API Overview .
Remote Config: I am making a lot of fetch requests while developing my app. Why doesn't my app always get the latest values from the service when it sends fetch requests?
During app development, you might want to fetch and activate configs very frequently (many times per hour) to let you rapidly iterate as you develop and test your app. To accommodate rapid iteration on a project with up to 10 developers, you can temporarily set a FirebaseRemoteConfigSettings
object with a low minimum fetch interval ( setMinimumFetchIntervalInSeconds
) in your app.
Remote Config: How quickly does the Remote Config service return fetched values after my app sends a fetch request?
Devices usually receive fetched values in less than a second, and often receive fetched values in milliseconds. The Remote Config service handles fetch requests within milliseconds, but the time required to complete a fetch request will depend on the network speed of the device and the latency of the network connection used by the device.
If your goal is to make fetched values take effect in your app as soon as possible, but without creating a jarring user experience, consider adding calls to fetchAndActivate
each time that your app does a full screen refresh.
Test Lab
Visit the Test Lab troubleshooting page for helpful tips and answers to FAQs.
Firebase User Segmentation Storage
What is Firebase User Segmentation Storage?
Firebase User Segmentation Storage stores Firebase installation IDs and related attributes and segments as well as audience lists you've created to provide targeting information to other Firebase services that use them, such as Crashlytics, FCM, Remote Config personalization, and more.