Running html and JS in Android - android

I have a web app, which contains a set of html, js and some static files like images,videos etc.
Specifically, I don't need a web server to run them. I can rum them in the desktop browser as a file protocol don't need the http protocol.
But when I take the same set of files in Android , it does not run and says Javascript is turned off (Android's stock browser, Firefox, Chrome or Opera). However, Javascript is turned on.
Do I need to serve the files from a web server or use http protocol if I am on android?

Related

WebServer on Android

I have a website, a set of HTML, JS, and CSS files, all this successfully works under Apache Cordova via WebView on Android.
I want to run it on Delphi, via TWebBrowser, but if I open index.hml via file:// then JS scripts will not get access to local files. Actually, the same thing happens on a PC, too.
I see the solution as follows: raise your HTTP server and connect to it from TWebBrowser. If my idea is correct, the actual question is: What is the reason to raise the WebServer for Android?
I am using Delphi 10.3 CE.

Is it possible to serve angular 2+ application directly from file system without server ? In Android or Xamarin WebView?

I have this angular 2+ application to be hosted in an IIS or some server. I will be using this application inside a WebView of my Android/Xamarin application. I know we can embed a static html files or serve static html files from Android's file system to Xamarin's webview without hosting it. As it has disadvantages like couldn't offer offline application, I was wondering, if we can server angular 2+ application similar to static html without hosting in a server ? (as in server, for SPA apps we can enable redirect rules to serve index.html in case of http request for routes).
Android emulator provides url to load content at 10.0.2.2:port
So you can run Angular cli server/iis and
Just load application in emulator with same port number of iis or your webpack

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.

How exactly does Sencha Touch wrap the native app?

When I compile my web app to a native iOS and Android app, how will it work? Will it be a regular web view that runs my app, which is in my server? Or it will place all the images, HTML and CSS files inside folders in the app project on Xcode and read them locally?
The latter. It will copy all files to the device, and run a webview which will load from the local directory. Think of it like you have some web files on your PC and point your browser to localhost to access them. It will load all the local pages/images even when offline, but you will face errors connecting to external resources unless online. Plenty of web apps are made without ever touching the developer's servers, also many times a simple restful solution will suffice.

jQuery Mobile can upload file?

I'm finding a jQuery Mobile plugin to upload image from my android tablet onto server, but so hopelessly! I've found the same question but Flash uploader on smartphone (or table) seems that a bad solution.
May jQuery Mobile support upload file from browser?
jQuery Mobile doesn't do anything to disable file uploads. It just doesn't style them due to browser security restrictions and you can't upload files with the AJAX navigation system. I use file uploads with jQuery Mobile in my application with no problem at all.
If you want to use file uploads with jQuery Mobile you have to do two things:
1) Turn off Ajax navigation using data-ajax="false" on your form definition because you can't upload files using Ajax.
2) Specify the appropriate encoding type of enctype="multipart/form-data" on your form.

Categories

Resources