Automatic Firebase synchronization

Hello, I will create this question because I have read several Firebase documents and I have not achieved anything so far. First of all I know that my question can have several extensive answers, but if someone can help me, I thank you right now.

  • I am creating a sales app, but I need to save these sales online.
  • for products I am using PARSE. It makes the query online and returns the products. If you do not have internet shows a warning saying that I'm without internet.
  • but in sales I would like to do different. The user could make the sale normally and when he connects on 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 as well. But I couldn't quite understand how it works. Today I already use Firebase in my project. I use the " module" Their Analytics. The rest I never stirred.

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

Thank you.

Author: Artur Mafezzoli Júnior, 2017-08-19

1 answers

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

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

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

  2. If you use Firebase Database with Offline mode enabled, you take this need out of a scheduled job to send these requests, as Firebase itself will take care of doing this.

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

 0
Author: Grupo CDS Informática, 2017-08-22 12:04:43