Bundling a file with a phonegap app

i-mad

New Member
I'm using Phonegap for developing my app. I used Backbone.js to implement my logic. I get xml files from the server and use the data in my app. This is the code responsible for it:\[code\] var CategoryCollection = Backbone.Collection.extend({ url:'http://www.someServer/someFile.xml', fetch: function(options) { options || (options = {}); options.dataType = 'xml'; Backbone.Collection.prototype.fetch.call(this, options); }, parse: function(data) { return $(data).find('someTag').map(function() { return { code:$(this).attr('code'), title : $(this).attr('title'), value : innerHtml }; }).get(); } });\[/code\]However, I need to find a way to make this xml data available locally upon installation, without requiring an internet connection. It's an app for tourists who may download the app when they're at home, but only run it when they're away from home, without internet access. So I thought to use the PhoneGap File API, but I'm having difficulty understanding how it works and where I can place the files to have access to them the first time app runs. Additionally, I would like the app to update the locally stored xml if the user has internet and the app detects that the server has a newer version of the xml file.I'm open to any kind of solution to this problem such as \[code\]localStorage\[/code\] or something else.I'd really appreciate some suggestions!Regards.
 
Back
Top