I'm sort of stuck with a iOS / phonegap question.
I have a XML on the server which I download successful with ajax. I even save the XML in the local storage and can read it later when offline.
The next step is the one where i need a startup. Within the XML I've got image URLs. I would like to download them and save them locally.
What is best practice and also the quickest way?
Do i need the FileWriter plugin for that? Or do i need to save them in a database as base64?
And after that how can i read them to show in the application?
Thanks in advance
There is no simple way as far as i can tell. You may wish to try using the cache manifest, or downloading them using code such as this: http://blog.clearlyinnovative.com/post/2056122828/phonegap-plugin-for-downloading-url-all-the-code
Full project here: https://github.com/aaronksaunders/FileDownLoadApp
Good luck
Related
I want to upload several pictures to server at the same time,the native plugin provide transfer,but this plugin can only upload a file at the same time.I don't want to call transfer.upload in while or for.What method can upload multiple files at the same time? Thank you very much for your reply!!! http://ionicframework.com/docs/v2/native/transfer/
Even though the example is for angularjs/ionic..,give it a try
Go through this tutorial.,you will get a some idea to proceed further.
https://www.thepolyglotdeveloper.com/2015/01/upload-files-remote-server-using-ionic-framework/
I am currently working on a hybrid app for iOS. I am using Ionic/Cordova to make it. It's my first time using it.
I want to be able to read an xlsx file that is currently on my iPad and show that data in my app in a table format. I have read about the ngCordova file plugin at http://ngcordova.com/docs/plugins/file/. I have also read about AlaSQL.js at https://github.com/agershun/alasql. Can I use these together to do my task? Or should I use one over the other?
I find the documentation for the file plugin to be a bit confusing. Can someone give me a pointer or example of accessing the file and outputting it?
Thanks!
try to use file plugin to retrieve directory list and fileOpener2 plugin to open xlsx file.
I am downloading a mp4 file with my iOS app, it works fine using
NSData dataWithContentsOfURL
but i need to updated only if the file has been updated,
can I check the file headers? or what is the best way to determine if the file has been updated so I downloaded it again?
Thanks
You can access the metadata using the http HEAD request, as explained in this SO answer. You'll need to create some sort of parser to pick out the information you need, though. Note that this might not work with every server, depending on how it has been set up.
If you have control of the server yourself, I'd recommend using a php script to output the date the file has been last changed, which you would call before downloading the file.
Personally, I prefer placing a manifest file (usually a plist) alongside the file in question, as it can hold even more data, for example metadata for several files, the number of entries in a database and the like. A backdraw of this approach is that you'll need to keep this file up to date, though. But often, that is worth the while.
Lastly, as rckoenes has mentioned, dataWithContentsOfURL is not a very good way to download files, espcially large ones. You really should be using some sort of datamanager class, which manages a NSURLConnection.
For a project we need to download and save pdf files on an IPAD device for offline use through an AIR for iOs application.
After a lot of searching I haven't found much information on this subject. My question is, can it be done, and if so, can you provide us with some pointers to lead us in the right direction.
Thanks for your time!
Sure, first you check if you can access the web - can use a class like air.net.URLMonitor, if you can you can set up a URLStream instance.
You get data while its downloading the file using the progress event, write that out to a File instance using the FileStream class.
To display the PDF file you can use a StageWebView or HTMLLoader.
I'm currently writing a mobile app (hopefully iOS or android) using the jquery mobile framework and phonegap.
It'll need to export/send csv files in some way to the users, but I'd be interested to hear ideas or suggestions about the best way of doing so. If this can be done on the js side of the app that'd be ideal as it's what I'm most familiar with. A couple of options I've considered are:
Uploading the file using the google docs api
Writing the file to the file system (then export e.g. via iTunes)
I'm new to this so any suggestions gratefully received! Thanks for your help
There are a few options that you could use depending on how you want it to work.
The main options would be to
Use the File API (http://docs.phonegap.com/phonegap_file_file.md.html#File) to store files on the filesystem of the device.
Upload the file to a server using a standard XMLHttpRequest.
Write a native PhoneGap plugin on each platform that you are interested in that could connect to Google docs.
As Dave pointed out you can write files with the FILE API. I have used the file api on iOs to write custom log files and havent found any yikes so far.