Exporting files from a Javascript based phonegap app - options or ideas? - ios

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.

Related

Reading .bundle files in Cocoa Application

I am creating a cocoa web browser using WKWebView and Swift. Like most browsers, they have extensions or plugins. I want to implement the same thing in my web browser. I came across CFPlugin. I want to use this feature but I do not know how. It would be good if you give a sample application.
I haven't tried anything because I don't know what to do
This is how I want my extension to look like
myExtension.bundle/
info.plist
scripts1.js
popoverview.xib
popoverview.swift
script2.js
popuppage.html
image.png
popuppage.css
I want to know how to read the files in the bundle
Thanks!
After a few minutes of trying I found the answer
Bundles are considered as Directories
so you can do something like this
MyBundle.bundle/Contents/Info.plist
MyBundle.bundle/Contents/Resources/MyView.xib

Working with custom user files

I'm currently studying swift and came up with such a question:
What are best practices to work with custom user files like .pdf, .doc?
For instance, I have application, that loads different files from server like .pdf, .ppt, .zip and so on, how to present them inside my app?
While googling I came up with solutions mainly for images, but nothing particular for other file types.
For now, what I have is - downloading files from server using Alamofire and saving them to documents directory.
Could anyone please recommend how to present this files inside my app after I saved them?
Possible solution that comes to my mind is web view, but what about zip? Is there some kind of universal solution? I know that there is Files App in iOS 11, but what about iOS 10?
Many thanks for your attention!

Reading an excel file using cordova in ios

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.

How to upload HTML File(contains img,css and js) to Contentful (CMS)?

I have created a sample HTML(contains js, css and images) guide. I want to upload this html file to CMS(content management System) to edit content later. After that I will retrieve html content from CMS System and load it in my iOS app. So my guide will not be static and I don't have to rebuild for my iOS app every time. I reviewed content-ful api service, but can't find a way to upload html file. is this possible ? Please help me on this? or any other ideas?
I think it's not unfortunately possible. In your case it's easier to add content manually to your Contentul space and then retrieve the content within web application using JavaScript SDK. If you're going to create iOS app as well, then Objective-C SDK and Swift SDK might be useful for utilizing the content in future.

How to use Google Drive in a Java Desktop app?

I am dealing with mobile and desktop applications. I am trying to use Google Drive as a permanent storage folder. Unfortunately I am at a loss because I cannot find any examples. Can someone point me at an example of storing or retrieving a file from Google Drive?
I would really like to see a simple example in code or maybe a library which can handle this. I am stuck at Retrieve and Use OAuth 2.0 Credentials https://developers.google.com/drive/credentials
Did you look at the sample app on the drive API page?
edit
google moved the examples to github
I don't know if I figured out your problem. What I have understood is that you are looking for a way that makes you able to work on the same project from different computers.
If so, you simply have to download Drive. Once install it will ask you what folder you want to keep syncronized with Drive. If you select your workspace, it will be syncronized with Drive. So, on another pc, if you have installed Drive, you will be able to use the workspace folder too, with the same files.
I hope this is helpful.
Marco
You should look into Documents List API.
The Google Drive API & SDK are meant to be a mean to integrate applications into the Web-UI of Google Drive. To protect the security of the user's files, it puts some restrictions to the application developer, like:
The app has to be installed from the Chrome Web Store
The app can only access files created from the app itself,
or files selected by the user using the Google Picker UI.
All these restrictions make the Google Drive API not a good choice for most non-web applications.
E.g. installing the app from the Chrome Web Store is probably something you would find cumbersome to request from your users for a mobile or desktop application. Nonetheless, without being installed from the Chrome Web Store your application will always receive an error when accessing a file from Google Drive.
The Documents List API allows you to store and load files (not only Google Documents!) into Google Drive.
This question is a little bit old, still. You can look at this example: https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2
They do the OAuth2 for accessing task. But I just used the same code to access the files using the v2 API. http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Drive_API
I only retrieved the file list, but it is working (from .NET, desktop app).

Resources