Cordova auto update application folder
Asked Answered
S

3

9

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

Shinn answered 28/8, 2014 at 15:27 Comment(2)
I don't think so.... try to use html5 cache and to store your html5 app remotely, if configured properly app can donwload pages only if they have been changed (update). w3schools.com/html/html5_app_cache.aspStevenage
Did you manage to handle the app updates by yourself ? I am trying to develop a library about this and would love your input on how to manage this particular issue -> [email protected]Faddish
A
7

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.
Andrea answered 29/8, 2014 at 5:42 Comment(0)
C
8

cordova-app-loader is an easy to use plugin to update app files via 3 simple steps:

  1. check() for a new manifest
  2. download() files
  3. update() your app!

It supports android and iOS

Cattleman answered 25/4, 2015 at 5:27 Comment(1)
cordova-app-loader is DEPRECATEDJohore
A
7

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.
Andrea answered 29/8, 2014 at 5:42 Comment(0)
F
3

Cordova Hot Code Push plugin also seems to address that matter. Its code seems much cleaner than cordova-app-loader and easier to use.

Faddish answered 31/5, 2016 at 15:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.