Synchronization system synchronization data and offline operation

I am developing an application using an ionic structure and it will extract some data from the API that was created using laravel, store it in the database, so when the user is offline, he can continue to use the application, I did a bit of research in Internet and found a plugin called pouchDB, is it recommended to me what I need? What is the best way to do this?

+6
source share
2 answers

PouchDb is convinced that this is a good solution for synchronizing data with your application. But depending on what you need to do, you can choose between several PaaS that provide natural data synchronization and stand-alone capabilities (along with many other features such as oAuth2 authentication and push notification).

I have worked with several, I can offer:

All of these platforms provide customers with the ability to work with all native mobile environments and javascript.

+4
source

Depending on the amount of data you want to cache, you can save it in local storage.

The logic will be like this:

  • Make an http request through your API
  • In .success response and save string in local storage
  • In .error analyze saved local storage response
  • Configure the same $scope variable from both .success and .error

Thus, if your requests are successful (the device has the Internet and the API is functional), the data is saved. Otherwise, the requests will not work (there is no Internet or for another reason), use the saved data.

An example of this can be seen here:

https://blog.nraboy.com/2014/06/saving-data-with-ionicframework/

However, as mentioned in the previous answer, PouchDB is a great option if you have a CouchDB database installed. Here are some tutorials for synchronizing solutions:

https://blog.nraboy.com/2014/12/syncing-data-firebase-using-ionic-framework/ http://devgirl.org/2014/12/30/sync-data-using-pouchdb-in- your-ionic-framework-app /

Hello,

+11
source

Source: https://habr.com/ru/post/982748/


All Articles