某些Firebase Android SDK依賴於Google Play服務,這意味著它們只能在安裝了Google Play服務的設備和模擬器上運行。這些Firebase SDK與設備上的Google Play服務後台服務進行通信,以為您的應用提供安全,最新且輕量級的API。某些Android設備(例如Amazon Kindle Fire設備或在某些地區出售的設備)未安裝Google Play服務。
哪些Firebase SDK需要Google Play服務?
Firebase SDK可以分為三類:
- 需要Play服務-這些SDK需要Google Play服務,否則就沒有功能。
- 推薦的Play服務-這些SDK需要Google Play服務具有完整的功能,但是即使沒有Google Play服務,它們仍然提供大多數功能。
- 不需要Play服務-這些SDKS不需要Google Play服務具有完整的功能。
下表僅適用於每個SDK的最新版本。一些較舊的版本可能有更嚴格的要求。
不需要谷歌Play服務
產品 | 圖書館 | Google Play服務? |
---|---|---|
驗證 | com.google.firebase:firebase-auth:20.0.4 com.google.firebase:firebase-auth-ktx:20.0.4 | 不需要 |
雲消防站 | com.google.firebase:firebase-firestore:22.1.2 com.google.firebase:firebase-firestore-ktx:22.1.2 | 不需要 |
Firebase Client SDK的雲功能 | com.google.firebase:firebase-functions:19.2.0 com.google.firebase:firebase-functions-ktx:19.2.0 | 不需要 |
Firebase的雲存儲 | com.google.firebase:firebase-storage:19.2.2 com.google.firebase:firebase-storage-ktx:19.2.2 | 不需要 |
速溶藥 | com.google.firebase:firebase-crashlytics:17.4.1 com.google.firebase:firebase-crashlytics-ktx:17.4.1 | 不需要 |
應用內消息傳遞 | com.google.firebase:firebase-inappmessaging:19.1.5 com.google.firebase:firebase-inappmessaging-ktx:19.1.5 | 不需要 |
應用內消息顯示 | com.google.firebase:firebase-inappmessaging-display:19.1.5 com.google.firebase:firebase-inappmessaging-display-ktx:19.1.5 | 不需要 |
Firebase安裝 | com.google.firebase:firebase-installations:16.3.5 com.google.firebase:firebase-installations-ktx:16.3.5 | 不需要 |
性能監控 | com.google.firebase:firebase-perf:19.1.1 com.google.firebase:firebase-perf-ktx:19.1.1 | 不需要 |
實時數據庫 | com.google.firebase:firebase-database:19.7.0 com.google.firebase:firebase-database-ktx:19.7.0 | 不需要 |
遠程配置 | com.google.firebase:firebase-config:20.0.4 com.google.firebase:firebase-config-ktx:20.0.4 | 不需要 |
必需或推薦使用Google Play服務
產品 | 圖書館 | Google Play服務? |
---|---|---|
AdMob | com.google.android.gms:play-services-ads:20.0.0 | 必需的 |
分析工具 | com.google.firebase:firebase-analytics:18.0.3 com.google.firebase:firebase-analytics-ktx:18.0.3 | 受到推崇的* |
應用索引 | com.google.firebase:firebase-appindexing:19.2.0 | 必需的 |
雲消息傳遞 | com.google.firebase:firebase-messaging:21.1.0 com.google.firebase:firebase-messaging-ktx:21.0.1 | 必需的 |
動態鏈接 | com.google.firebase:firebase-dynamic-links:19.1.1 com.google.firebase:firebase-dynamic-links-ktx:19.1.1 | 必需的 |
Firebase ML視覺 | com.google.firebase:firebase-ml-vision:24.1.0 | 必需的 |
Firebase ML自定義模型 | com.google.firebase:firebase-ml-model-interpreter:22.0.4 | 必需的 |
*用於Google Analytics(分析)的Firebase SDK可以在任何設備上發送事件,但是某些自動見解(如人口統計信息)僅在具有Google Play服務的設備上可用。