我一直在使用SQLite作爲我的android應用程序的存儲解決方案。我希望能夠將同步功能添加到我的某個應用中,Firebase看起來像是一個很好的解決方案,但問題是我需要知道是否要使用Firebase將數據與SQLite數據庫同步,或者Firebase可以工作並完全替代SQLite 。我知道Firebase具有離線持久性,但離線時它可以保存與SQLite一樣多的數據,並且查詢功能強大嗎?Firebase而不是SQLite
回答
顯然這取決於考慮選項的業務規則。所以不會有這個「正確的」答案。
我們至少有一個團隊成員正在考慮這些方面。下面是我們的解決方案:
是否所有的交易數據,在本地的SQLite作爲我們並不需要交易是跨設備。
使用Firebase同步其餘部分。
(1)確保我們不會誤用Firebase的客戶端的非永久性離線可用性。
The docs Even with persistence enabled, transactions are not persisted across app restarts. So you cannot rely on transactions done offline being committed to your Firebase Realtime Database. To provide the best user experience, your app should show that a transaction has not been saved into your Firebase Realtime Database yet, or make sure your app remembers them manually and executes them again after an app restart.
(2)確保我們使用火力地堡的永久下線性質進行同步跨設備非事務性數據連接建立後(重)。
The docs,The Firebase Realtime Database client automatically keeps a queue of all write operations that are performed while your app is offline. When persistence is enabled, this queue is also persisted to disk so all of your writes are available when the user or operating system restarts the app. When the app regains connectivity, all of the operations are sent to the Firebase Realtime Database server.
這種方式,我們實現我們的使用中可以接受的狀態。
「它可以保存與SQLite一樣多的數據,並且查詢功能強大嗎?」如果將強大功能翻譯爲「跨設備的transaction」,則按照Firebase作爲遠程數據庫的定義,否則不。
- 1. Firebase返回null而不是數據
- 2. 導入FirebaseAnalytics模塊而不是Firebase
- 3. SQLite更新或插入,而不是Upsert
- 4. 降序SQLite Integer而不是字符串
- 5. 圖像到SQLite,而不是畫廊
- 6. RAM中的SQLite表而不是FLASH
- 7. 作品SQLite中而不是在PostgreSQL的...屬性不是1
- 8. firebase部署不更新html文件,而不是緩存問題
- 9. 不是SQLite中
- 10. 是否可以使用PreferenceActivity與SQLite而不是res/xml?
- 11. 的SQLite SELECT不是工作,而是用繩子文學作品
- 12. Android的SQLite查詢其中列不爲空,而不是空
- 13. 添加值而不是更改值在Firebase中使用Swift
- 14. 在Swift 3中添加數據到Firebase而不是SetValue
- 15. firebase的父母身份證返回而不是孩子ID
- 16. 爲什麼Firebase返回數組而不是字典?
- 17. 使用Java發送Firebase通知,而不是FCM控制檯
- 18. React應用程序在本地建立,而不是通過Firebase
- 19. 爲什麼我在Firebase-RealDatabase上獲取ArrayList而不是HashMap?
- 20. Angular js phonecat使用Firebase而不是.json文件
- 21. Firebase uid返回電子郵件而不是uid
- 22. Firebase覆蓋現有記錄而不是追加它們
- 23. 是否有可能使用SQLite數據庫而不使用sqlite函數?
- 24. Firebase不是構造函數
- 25. Firebase CDN不是gzip'ing index.html
- 26. Firebase TypeError:childSnapshot.child(...)。set不是函數
- 27. aiohttp和firebase和firebase-admin - 是不是阻止?蟒蛇3.6
- 28. SQL查詢通過SQLite的作品,而不是PostgreSQL的
- 29. Java的檢索sqlite的返回數據對象而不是值
- 30. 在iOS應用程序中使用.mdb文件而不是SQLite?
根據Firebase脫機功能文檔「默認情況下,先前同步的數據將被緩存10MB」。它聲稱具有智能同步功能。除非您預計數據存儲高於10MB,否則只需使用Firebase即可。請參閱文檔[https://firebase.google.com/docs/database/android/offline-capabilities] – ADimaano
謝謝,我需要一個脫機的第一個解決方案,預計超過10MB,因此Firebase可能不是解決方案: (Realm移動平臺看起來更像我想要的。 –