samedi 12 mars 2016

Updating sqlite DB from remote MySQL DB best approach

I am creating an app that will have many records in the future and I need to update the local sqlite database from my remote mysql database but I am not sure if what I have done is the best approach .. these are the steps that I have done up until now using the swipe to refresh feature when the user pulls to refresh:

  1. Retrieve data (products from allproducts table) from MySQL using Retrofit

  2. Delete old products records in allproducts table in my local sqlite database

  3. Insert retrieved products from remote database into allproducts table in local database

  4. View the data in a recyclerview list

I'm quite new to this way so I am not sure if what I am doing is the right way..I wanted to get the same results like in gmail app or twitter..I don't want to only use remote database when refreshing I want to allow the users to use the updated list even when they are offline or something like caching the mysql data received..I hope you understand what I mean..can someone please advice or guide me.. Thanks!

Aucun commentaire:

Enregistrer un commentaire