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:
-
Retrieve data (products from allproducts table) from MySQL using Retrofit
-
Delete old products records in allproducts table in my local sqlite database
-
Insert retrieved products from remote database into allproducts table in local database
-
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