Android web application on cloud storage - android

I have a cloud storage website and I want to create an Android application for that website.
I tried 2 methods.
First Method
Using Phonegap to open a remote website which handles everything and its built-in PHP so everything works fine. But a Cloud Storage app must allow uploading and downloading. In Phonegap I can upload through the website but can't download directly to local storage. It can only be done locally if my website is in the local www folder. Also in this way API of Phonegap can't be used either. If I download any file the browser opens up, in this case.
Second Method:
I tried to use Phonegap locally and just create an API of my cloud storage website so that locally with the help of jQuery ,Ajax so that I can post data to the remote URL, but that can't be done due to the Same Origin policy. I may receive the JSON data of files and show but can't log the user in and other features. :( Again a problem.
What else can I do? Is there any other method or solution you can provide me regarding these two methods or any alternative method I can use?

Depending on the kinds of data you're talking about there are several alternatives.
You're describing a cloud storage app (I'm assuming like drop box or Google drive right).
Therefore you'll want to write to the file system instead of some kind of database (locally ofc)
I would therefore check out the following api docs;
http://docs.phonegap.com/en/2.1.0/cordova_file_file.md.html#File
Examples are there too.
PS ive had same origin problems in development, but they seem to go away in production, try testing there too.

Related

Update offline webpages without updating app

I have an app which contains html files which i am displaying using a webview. This html files are nothing but documentation the users of my app require. My question is, can I update these html files without asking the user to update the entire app? I dont want to replace these html files by hosting the documentaion online.
You will have to do one of these:
Update your app (which is what you don't want)
Host the raw .html files on a web server, and whenever the user opens the app, check if there are new files available and download them.
Simply create a website that shows the .html files and open the
website in your app (which i'm guessing is what you don't want
either)
So you're left with option 2.
To update files without requiring an app update, you will need the app to obtain the HTML content online.
One option, which you mentioned you don't want, is loading a URL into the WebView rather than local HTML files.
The other option would involve hosting the web pages somewhere and the app would download them. The only benefit of this I can see, is that if the device is offline is can use the last obtained HTML file. You could just use caching to achieve this though.
How complicated are the webpages? Using JSON is another method.

Is there anyway to send files to public folder from Android?

I got a website hosted by Parse.com and it has its own tool to upload files.
I want to know if is there any way for me to send files from android app. I have my data shared with my android app, and it would be great if I can send images to the web site.
You should use the Android-Library of Parse.com.
It makes it very easy for you to connect your Android App to the Parse backend.
If you look at the docs, there is a section about uploading and downloading files.
https://www.parse.com/docs/android_guide#files
I've never tried it but I think this will allow you to upload your images to the backend.
There is also a JavaScript library to connect your website (client side) to the parse backend.
Again, if you look at the docs, there is a section about uploading and downloading files.
https://www.parse.com/docs/js_guide#files
You should be able to use the JavaScript library to access the previously uploaded app-images.
The basic flow would look like this:
Android App -> Android Parse Library -> Parse Back End
Parse Back End -> JavaScript Parse Library -> Website
Keep in mind: This is all hypothetical since I haven't tried it.
You can use Es explorer https://play.google.com/store/apps/details?id=com.estrongs.android.pop Install this application and then select network option in that select ftp . Then connect to your ftp server using your credential. then copy paste thats it

How to upload files to HTML5 Web App from Google Drive or Onedrive?

I am designing an web application that will allow applying for the jobs we post in our career page. The application will use responsive design and should make it easy for mobile users (iOS and Android initially) to upload their resumes. I read something about uploading files to Google Drive or MS Onedrive using their corresponding APIs. However, I am trying to do the opposite; browse files, select a resume, perhaps download it locally, and finally upload it to my web application.
Do you know if this is possible? If so, what would be your recommendation?
Thanks in advance!
First you can ask the user to authorize to use their Google Drive Data using OAuth2.0. The below two reference links from the Google Drive API will be useful
1.Get the list of filenames using the filelist option in the api and fetch the filename from the list https://developers.google.com/drive/v2/reference/files
2. Download the file directly to your server using the Downloads feature of the API
https://developers.google.com/drive/web/manage-downloads
I hope this gives you enough direction to proceed further.

how can i manage phonegap android online app

i'm beginner developer of phonegap android application developer. i'm in confusion. i want to make a photo gallery that work online(with internet). 1st: how can i embed my photo gallery with the application. 2nd: if user connection lost during checking photos there is not show the my app url (could not find URL http://www.domain.com/app/index.php) after connection lost it will go to on default error page of no internet connection.
my online application is in php how can i iframe that app in my native application.
phonegap android application developer help me. i'm very thankful to you for this.
Phonegap is not really a way to embed a full application inside an app. The app itself is its own website (sort of).
Your best direction is to create a PHP page on your sever that outputs an XML or JSON file of the images you are going to show THEN create a custom application using HTML / Javascript that pulls in the XML/JSON and parses it into your app. For best practise you should cache or store said files locally for when the device isn't connected to the network.

HTML5 Android Phonegap Web app not working offline with cache manifest

I have a simple web app built with Phonegap and Android that call external ressources (js, css, html) from server instead of storing it in Phonegap assets folder. I prefer using external ressources because my server can deliver html pages taking in charge internationalization.
This web app work fine on my android device when WIFI is on but it fail when stopping WIFI. My index.html file delivered by my server contain a valid manifest file with correct mimetype ('text/cache-manifest') that list every files the app need to work.
My Android Activity class is supposed to have caching enable:
this.appView.getSettings().setDomStorageEnabled(true);
this.appView.getSettings().setAppCacheMaxSize(1024 * 1024 * 15);
String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
this.appView.getSettings().setAppCachePath(appCachePath);
this.appView.getSettings().setAllowFileAccess(true);
this.appView.getSettings().setAppCacheEnabled(true);
It may worth mentionning that my app use ajax call with urls like /aaa/bbb/ to call web pages from server and I don't know if that may be the problem (l'm not calling physical pages directly like index.html)... However, this web app work well in desktop browser (Google Chrome) when offline...
Any idea what more can I do to enable this HTML5 cache feature on my Phonegap app?
Thanks a lot
After playing around for a while I get it to work. Here is some points you should verify when stucked with this type of caching problem:
Take care about url parameters passed with GET method... I was passing parameters when navigating between pages of my app and those parameters was making my urls different from the ones in manifest file making cache to fail.
When testing offline mode on my phone, I was only shutting down the WIFI thinking this was enough to trigger cached version of my app but it was not... As I was testing my app published under a local network IP (like 192.168.2.11), it appear that my app was trying to reach that IP trough the 3G network that was still ON... So use airplane mode when testing offline.
Not sure if this one was necessary as I read it on some others threads but I renamed my manifest file to cache.manifest.
Regards
Apparently you need "to fix the Android Shell Native App to enable HTML5 caching".
If you haven't already, please check out: http://tmkmobile.wordpress.com/2012/03/04/html5-offline-solution/
I am developing a similar system. What I did was I created the Phonegap webpages and stored them in the www folder of my WAMP server. Then what I do is I basically super.LoadURL("insert_ip_address_here/insert_name_of_folder_where_webpage_is_located") in the onCreate method and this loads the phonegap application perfectly (yes all you need is just only line of code in the Android app itself). However you still have to make sure that the config.xml, manifest and all configurations needed for phonegap are properly done (for instructions on this see https://www.adobe.com/devnet/archive/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html).
Let me know if this the path you choose to pursue. I can provide extra support with things like making the ip-address (in the line super.loadurl(...)) dynamic for the local system using multi-casting, etc.

Categories

Resources