Android Webview Performance differences - android

I am writing a webview app in android 4.4.3 the latest Android version.
But my biggest Problem is the performance differences between the chrome browser and my webview app.
The differences are huge.
How can I get the webview app to the same performance as the chrome browser?

Try this code. It will help you in increasing the speed -
webview.getSettings().setRenderPriority(RenderPriority.HIGH);
webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
Also try adding this to Manifest under desired activity -
android:hardwareAccelerated="true"
EDIT
Chrome does not use webview - source.
Does this mean Chrome for Android is using the WebView?
No, Chrome for Android is separate from WebView. They're both based on the same code, including a common JavaScript engine and rendering engine.
That is probably the only reason for the performance difference

Related

Using Chrome component as WebView app container

I have issue: in standard browser on some Android 4.2-4.4 devices my html page in some reasons (which I don't understand yet) looks broken as like as part of css just lost. But in Chrome app they are always looks good. So is there option to use Chrome app as main container for my webview application?
So is there option to use Chrome app as main container for my webview application?
WebView is using Chromium on Android 4.4+.
You cannot embed Chrome in your app, other than to the extent that WebView does.
IIRC, there are third-party libraries for embedding alternative Web rendering engines in an app. I seem to recall there being a standalone Chromium build, and Mozilla was working on allowing Gecko to be used as a library. I have not checked on the status of these in quite some time. You would also then be responsible for security updates for those Web rendering engines, and the libraries may substantially increase the size of your app.

How to run PhoneGap on a different WebView on Android?

PhoneGap/Cordova is running on the native webview on Android browsers which is the webkit version 534.30 up to Android 4.4. I searched for alternatives to use a newer webview, e.g., Chromium based. Here is what I found:
https://github.com/MobileChromeApps/mobile-chrome-apps
CrossWalk
cocoonjs
There are some drawbacks. When you add a compiled Chromium webview to your PhoneGap app you get up to 40MB in app size which is very much.
Is there another way to use a different webview on Android than the native webview without increasing the app size to much?
Think a webview is almost a complete browser. Currently the only option available for creators is to compile a free browser and add webview interface.
You can take a look to all the features supported by a chromium-based webview in the following link:
http://support.ludei.com/hc/en-us/articles/202308176-Webview-Supported-APIs

open the content in chrome browser phonegap

I need help resolving the error I get when I run a phonegap android app. I'm iframing a page with an embedded UStream feed. Everything else loads perfectly expects the ustream section and I get the error:
Sorry! The stream could not be played on this device.
Open the Content in Chrome Browser
Any assistance you can offer will be greatly appreciated.
Probably what is going on is that the UStream feed uses some HTML5 or other fancy API that is not yet in the WebView that Cordova/PhoneGap uses. You see, Phonegap uses a native WebView component to render the HTML content of your app. The problem is that this WebView is an oooold version of WebKit and doesn't support HTML5 and some other things. This is why the same web page will sometimes act differently depending on if you open it with Chrome browser, the standard Android browser, or with a Cordova WebView. This problem exists for all platforms as far as I know.
The slightly good news is that they just announced that Android 4.4 will have an updated WebView based on Chromium code, so hopefully your iframe will work in a 4.4 version of Cordova.

Ttitanium webview and HTML5 application cache

I am using Titanium to create a application for Android. The app uses webview to load external HTML5 webpages. The webpage uses a manifest to cache the page and some assets. This works fine on desktop browsers and third party app browsers in Android (Chrome).
When I view the page in a webview in the Titanium build app, it seems that the manifest is not used, the page just loads everything from the server. The same problem occurs when I use the build in browser of my phone (HTC one X).
What I am trying to accomplish is that the pages are offline available, so that internet is not required tot view cached pages. Is there a fix for this problem, or should I go look in another direction to solve my problem?
the manifest file:
CACHE MANIFEST
# version 1
leerlingen.html
jquery.js
style.css
handler.js
NETWORK:
*
First: Titanium provides much more than a WebView. If you planned to display only web pages you maybe should have a look at PhoneGap / Cordova which might fit your needs in a better way.
As you've noticed not all browsers support HTML5 Caching feature as expected. I can't say if it doesn't work for Android in general or only for your specific version because WebKit usually does support it but it depends of the used WebKit version. And this could be different.
EDIT: It seems that (in native android) this feature can be enabled as written here: Application cache in HTML5 doesn't work in Android PhoneGap application. This is currently not possible in Titanium (there might be inofficial tweaks i don't know but from http://docs.appcelerator.com this is not possible).
Personally i'd prefer another solution. Cache data by myself and display it if there is no network connection. But this depends on what you try to achieve. Having few content which doesn't change often this would make sense. Having dynamically changing data (like twitter stream for instance) this would be difficult. Also it depends on your users and where they want to access your app.
And there is an open question: When you want to use all the caching features why do you want to create an app? Creating a simple mobile webpage would do the same job. When creating an app i wouldn't use the Caching Features of HTML 5. You should keep all the static resources in your app and simply load data from the network. This can be achieved by both Titanium and PhoneGap / Cordova. Titanium is more useful for a native UI and some native Features while PhoneGap / Cordova would be more appropriate for HTML5 based layout.
Just in case someone else is running in the same problems that i was facing, here is what i've done. HTML5's application cache does not seem to work in the build-in browser of Android and with that the webviews. In Titanium there seems to be no way to control the webview as to enable the application cache.
The work around for me was to use Titanium and it's httpClient function (Titanium.Network.HTTPClient) to request the files (HTML, CSS, javascript) and store it in the local app filesystem (Titanium.Filesystem).

android webview using firefox render or engine

My Web site is html 5 and if website open in firefox browser than it work very well. so is it possible to use firefox rendering engine or can i change default webkit or is there any third part library
No. A website cannot decide what rendering engine should be used to render it. The best way is to fix your website so that it renders correctly on all major browsers.

Categories

Resources