Firebase automatic synchronization

0

Hello, I will create this question because I have read several Firebase documents and I have not gotten 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 right away.

  • I'm creating a sales app, but I need to save these sales online.
  • I'm using PARSE for the products. She checks online and returns the products. If you do not have internet, it will give you a warning that I'm out of the internet.
  • But in sales I would like to do differently. The user could make the sale normally and when he connects to a network these sales would be sent automatically.

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

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

Thank you.

    
asked by anonymous 19.08.2017 / 19:12

1 answer

0

I will try to be as brief as possible, and I will respond based on the 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 generally this is a strategic decision of your architecture.

  • 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 sending these sales directly to the server, if you have not saved it locally and then the routine will send.

  • If you use Firebase Database with Offline mode enabled, you take the need for a scheduled job to send these requests, as Firebase itself will do this.

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

        
    22.08.2017 / 14:04