Automatic synchronization Firebase

Asked

Viewed 306 times

0

Hi, I’m going to ask this question because I’ve read several Firebase documents and I haven’t been able to get anything so far. First of all I know that my question may have several extensive answers, but if anyone can help me, I thank you already.

  • I’m creating a sales app, but I need to save these sales online.
  • For the products I am using PARSE. She makes the online query and returns the products. If there is no internet show a warning saying I am without internet.
  • But in sales I’d like to do it differently. The user could make the sale normally and when he connects to a network these sales would be sent automatically.

Nowadays I know that there are several libraries that do this (Realm is one and Firebase is another) Reading the Firebase documentation I know that it does this too. But I could not understand very well how it works. Today I already use Firebase in my project. I use their "module" Analytics. The rest I never touched.

So I wonder if someone can explain this to me better ? Or if someone has done this kind of synchronization and if I can help, it would be rewarding.

Thank you.

1 answer

0

I will try to be as brief as possible, and I will respond based on firebase, and also with the premise of a local database.

In a nutshell, it is perfectly possible to do this only for sales in the case, but usually this is a strategic decision of its architecture.

  1. If you use Realm (one of the many db for android), you have to have a manual or scheduled sales sync routine. If you have internet try to send these sales directly to the server, if you have not saved locally and then the routine will send.

  2. If you use Firebase Database with Offline mode enabled, you take away this need for a scheduled job to submit these requests, as Firebase itself will take charge of doing this.

What you could do, as you already use PARSE in the application and not have to migrate to the Firebase Database, is to follow the line of the first alternative. I think it’s gonna be a minor impact on the app. But as it is only sales and has no very complex database logic, I think Realm is a bit too much, can use a common Sqlite even.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.