Android本地SQLite与Firebase同步 [英] Android local SQLite sync with Firebase

查看:112
本文介绍了Android本地SQLite与Firebase同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其默认选项是将用户数据存储为本地 SQLite数据库,但是,如果用户要登录并将本地数据库传输到该数据库,我想添加该选项一个在线数据库,以便可以在多个设备上对其进行访问.

I have an app where the default option is to store user data as a local SQLite database, however, I want to add the option if the user wants to sign in and transfer the local database to an online database so it can be accessed on multiple devices.

我在云存储解决方案方面经验不足,因此任何建议都将不胜感激.对于我的应用程序来说,是 Firebase实时数据库 最好的在线解决方案?还是我应该研究另一种方法?

I don't have much experience with cloud storage solution so any advice would be really appreciated. Is for my application the Firebase Real-time Database the best online solution or is there another approach I should look into?

推荐答案

Firebase的实时数据库确实是解决您问题的最佳解决方案之一.它有一个免费的免费计划,并且已很好地集成到Android Studio中. 而且,如果您的数据结构足够简单,则可以完全删除SQLite并使用 Firebase的离线存储.这将使Firebase能够自动为您处理离线数据的同步(通常,您自己很难实现同步).

Firebase's real-time database is indeed one of the best solutions for your problem. It has a generous free plan and is well integrated into Android Studio. And if your data structure is simple enough, you can drop SQLite altogether and use Firebase's offline storage. This will allow Firebase to automatically handle syncing of offline data for you(syncing is usually painful to implement by yourself).

或者,您可以构建自己的Web应用程序并将REST API公开给Android应用程序.这给您带来了控制一切的优势.但是,由于需要大量的知识和时间,因此我不建议这样做.

Alternatively, you could build your own web app and expose a REST API to your android application. This gives you the advantage of having control over everything. I would however not recommend this because of the amount of knowledge and time required.

这篇关于Android本地SQLite与Firebase同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆