PhoneGap stores HTML files on the device
I need to create an app for Windows Mobile and iOS. So I decided to create this using PhoneGap.
The app should only display HTML files. These files are stored on the server and can change every day.
So, I have already created an API that supplies the files. My solution would be: In my PhoneGap application, I am using AJAX to receive files (this is not a problem and should already work ...).
To the question: How to save files on the device? Is this possible with PhoneGap? The app should work offline (because of this I need to store files) ... And if possible: it should only sync differences (between device / app and server) -> rsync keyword ??
Thanks for the help! Emanuel :)
source to share
Have you checked here?
You can store files locally on Android platform. (I've already done it). However, I didn't do this on IOS.
So please investigate if the features I gave the link above are available for safari (iOS).
The diff only sync needs to be implemented on the server side and should be responsible for your API.
source to share
Yes, you can store files locally.
I would recommend the file transfer plugin for uploading files. It supports iOS and Windows 7 and 8 and can download and save the file locally. In the Cordova github file plugin you can see the paths where you can save the files for iOS, I haven't found a table for Windows Phone yet.
But I would not recommend that you upload HTML files as they can be very large. You need to dynamically create the mobile pages you want as you only need to load the display text and attributes for some HTML tags.
How you can do this is to have a backend server where you can change the content of the pages. The simple HTML should then be saved to the database with a creation and modification timestamp (need to check if you have the latest updates). Then you will pull the data from the database using PHP and echo
as JSON. Your application just needs to be done AJAX-GET request
on the server and store the data locally in the database. I would recommend the Cordita SQLite Storage plugin for local database. Whenever a page is opened, you have to dynamically create a mobile page.
This way, your application does not request a huge amount of data from the server, which may be more attractive to the users of your application.
source to share