Search code examples
androidcordovadata-synchronization

Cordova auto update application folder


I have an offline application cordova, composed of simple html and pictures, all inserted in a sub folder (android_asset/www/app). I would like to add a second online application (android_asset/www/update/) that, check for update, download and replace the first. Is this a reasonable solution for in app synchronization?

Thanks for the time


Solution

  • You could achieve desired functionality if you will use Cordova File Plugin. Main trick is to load files not from android_asset/www/app, but from location on the phone storage, using cdvfile protocol (which point to the file location on the phone SDcard).

    1. When you application starts first time, you will go to you server and save latest app version to the phone storage, and then launch you app logic code from there.
    2. When you check for updates, you download new files to you app location and next time application will use these files.