Modify app assets using Phonegap's File API

I worked on a phonegap application using html5 for a month. I handle offline JSON files using File API.
It seems that the JSON files I store are automatically saved on /mnt/sdcard/.

The problem is, I find myself handling 3 files for each file I want.
1 st the file packaged with my app (js/products.js)
2 nd the remote file that sends me updates (http://website/remote_products.js)
3 rd the local file on sdcard I update with the remote data. (/mnt/sdcard/updated-products.js)

  • What's the meaning of android:progressBarStyle attribute in ProgressBar?
  • Lollipop: Disabled button --> which style?
  • Android: Preventing going back to the previous activity
  • How to pass integer from one activity to another?
  • How to make a custom toast fill width?
  • android dialog transparent
  • Is it possible to – instead of saving on the sdcard – update my app’s assets using File API ?
    Or create a new file in my app assets folder ?

    (the JSON file packaged with my app. Found in js/products.js)

    If yes, how plz ?


    Related posts:

    Updating Android SDK: “A folder failed to be moved.”
    After changing a preference (a setting), text showing settings doesn't update
    Android content provider query IN clause
    How can I give an imageview click effect like a button on Android?
    Android sending lots of SMS messages
    PopupView not showing up?
  • Using layer-list to display some drawable images
  • Does createScaledBitmap() use px or dp?
  • Android SimpleCursorAdapter doesn't update when database changes
  • How to avoid cut/copy/paste in smart phone after rotation port to land on Android4.X?
  • How to send unicode characters in an HttpPost on Android
  • How set ViewPager inside a Fragment
  • 2 Solutions collect form web for “Modify app assets using Phonegap's File API”

    Sadly, you cannot modify the files in /android_assets/www with the File API.

    See this answer to a slightly different question answered by one of the PhoneGap Android devs:

    “You can’t do what you want to do. The files in the assets directory are not technically on the file system so they are not accessible via the File API. This means calling window. resolveLocalFileSystemURI() will not return you a FileEntry.”

    You might consider to utilize Mott:, e.g.

    It seems to be able dynamically version, update and persist update of any local asset.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.