0

Consider a PhoneGap gallery project with both Offline & Online Viewing.

Now for Offline viewing (when the user has not logged in system) we can store the related image assets & JSON file within the www folder and display the gallery based on the JSON data. That is all fine.

For Online viewing, (when the user has logged in system) we would load the JSON from the server and now display the gallery based on the online JSON data. There is a CMS module, where one can modify/update the images and their respective description as well. So once when the user has logged in, he/she is able to view the latest gallery. But soon the user logs off he/she will be shown a gallery based on the older JSON file.

Remedy is to replace the existing JSON with the latest JSON data, plus downloading/replacing the existing images with latest ones from the server. For one of my previous post, Josemando Sobral had already pointed out that the content of www cannot be changed/altered post deployment on the mobile device. So my questions (considering there will be frequent updates to CMS) here are:

  1. Would localstorage + database be a better option for this scenario? Would the database size be an issue in future, as more and more images or data gets inserted to the database?
  2. Or should we place all the images and JSON file out of www folder, somewhere in the SD card lets say file:///mnt/sdcard/project_www ? And make all the download/replacing of files there?

But for any reason sd card is unavailable or being chanaged or corrupted or data being wiped off, offline viewing wont work.

Please do guide me on this front.

2 Answers 2

1

Sounds like you would be better off placing the files somewhere on the SD card or internal memory.

0

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

Where X is the identify of your application

Downloading files to a PhoneGap application

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.