In PhoneGap, once the app is downloaded and installed, can we update / overwrite existing JSON / image files?

Consider a PhoneGap gallery project with offline and online viewing.

Now for offline viewing (when the user is not logged in) we can save the associated image objects and JSON file in the www folder and display the gallery based on the JSON data. Everything is good.

For online viewing (when the user is logged in), we have to download the JSON from the server and now display the gallery based on the online JSON data. There is a CMS module where you can change / update images and their corresponding description. Therefore, when the user is logged in, he can view the latest gallery. But soon the user will be logged out and will be shown a gallery based on the old JSON file.

The fix is ​​to replace the existing JSON with the latest JSON data, and load / replace existing images with the latest data from the server. One of my previous posts to Josemando Sobral already pointed out that the www content cannot be modified / modified after deploying to a mobile device, so my questions are (considering that there will be frequent updates to the CMS):

  • Would localstorage + database be the best option for this scenario? Will database size be an issue in the future as more and more images or data are inserted into the database?
  • Or should we put all the images and JSON file from the www folder, somewhere on the SD card we can say the file: /// mnt / sdcard / project_www ? And do all download / replace files there?

But for some reason, the sd card is not available or at risk or damaged or data is erased, offline browsing does not work.

Please help me on this front.

0


source to share


2 answers


It looks like you better place the files somewhere on your SD card or internal storage.



+1


source


You can save and use files to and from Android / data / X

Where X is your application identification



Uploading Files to the PhoneGap App

0


source







All Articles