4
votes

I'm using Phonegap with jQuery Mobile and have the following use-case:

  • I want to download a file from a remote server via JSON.
  • Store the file on local filesystem of the mobile device (to work also offline).
  • Target platforms: iOS, Android, maybe Windows Phone and BlackBerry.
  • Load file from filesystem.

What's the recommended way to do that?

  • Phonegap.FileWriter? Is there also a way to save it to "assets/www../"?
  • Phonegap.Storage?

Or is there any better way?

1
Can you tell us what platforms you are targeting? - codaniel
Android, ios and windowsphone - user1165474
Hi user1165474, Have you solved this problem? Can you please post your answer, as I am having same kind of requirements. - Mrunal

1 Answers

1
votes
  • Use XHR to download the JSON data.
  • Use the FileWriter to save the file to the file system.
  • Use the FileReader or XHR to read the JSON file from the file system.

No, you cannot save the file to assets/www as it is not writeable.