All,
My webpage contains html5, it is OK on ANDROID 4.4, while something wrong on ANDROID 4.3.
After google it, I found
Android 4.4 update the webview.
Is it possible to use new webview on ANDROID 4.3(or 4.X)?
No, not directly.
You may like to investigate the XWalk Project[1]. However, some things to be aware of:
it is not a drop in replacement for WebView. Some APIs are missing or work differently
there is a significant increase (~25MB) to your APK size, and RAM size will increase too.
[1] https://crosswalk-project.org/
Related
I'm trying to inspect an app in Android 4.2 and 4.3, i'm able to inspect this devices using chrome (https://developer.chrome.com/devtools/docs/remote-debugging), but I need to test this on Webview, i didn't find a solution.
Some css are rendering different from newer versions of Android. HTML5 and CSS3 are suported in Android 4.3 webview ??
Currently there is no straight forward way to debug . one solution is to override the onConsoleMessage[which is used to print console statements],onJsAlert [used to show the alerts] methods of WebChromeClient attached to that webview ,get the logs and alerts , based on that upto some extent we can debug. Hope this solution helps you.
Since there is a known bug in Android Kitkat versions (most commonly 4.4.2) that disallows users to open file upload dialog after tapping any HTML file element within WebView, can Android itself determine if current device suffers from this bug?
Determining only by Android version is not a good solution since not all devices running 4.4.2 suffer from this bug.
I had to deal with this problem too. Eventually I decided it's not worth it because not that many device modifies the stock webkit, so I applied the workaround based on version number alone (SDK_INT == 19)
However if webkit is really the culprit (and not some other system class), you may want to detect the webkit version: https://stackoverflow.com/a/29218966/828752
From https://developer.chrome.com/multidevice/webview/overview#what_version_of_chrome_is_it_based_on_:
The WebView shipped with Android 4.4 (KitKat) is based on the same
code as Chrome for Android version 30. This WebView does not have full
feature parity with Chrome for Android and is given the version number
30.0.0.0. The updated WebView shipped with Android 4.4.3 has the version number 33.0.0.0.
This detection method isnt very elegant however as there is no precise way to detect occurrence of this bug on a device best way is to count via javascript how many times a user has clicked the HTML FILE element.
If the counter of clicks exceeds some value (because the user is trying to get it work over and over) you know its not working. At this point by far most common version with this bug is 4.4.2 so you can activate this counter only when this Android version is detected for extra layer of precision.
Like I said, this detection method is quite messy however if Android has a bug this is as good as it gets. Users who dont experience this bug are unlikely to click more than once the HTML FILE element.
I am working on a cross-platform application developed using html5, css3 and angularJS.
I am facing an issue in showing the ScrollBar on android device.
I have used -webkit-overflow-scrolling: touch;
It is working fine on iPAD but its has no effect on android device.
Need help.
Thanks in advance
As you have rightly said, Android native WebView does not "show" a scroll bar when using overflow:scroll|auto. But the scrolling is allowed when you touch and move the container around. So scroll should still work as expected, without the bouncy effect.
Another Android catch is till 4.4, the native WebView is not the one used in Chrome, i.e. ChromeView. So you are going to have to deal with it by using a javascript polyfill, like overthrow.js [http://filamentgroup.github.io/Overthrow/] or iscroll. Personally, iscroll ux sucks on Samsung Galaxy Tabs.
But if you are targetting Android 4.0>=, then this might help https://github.com/pwnall/chromeview. Haven't personally tried it though.
Check out for more details on webview changes https://developers.google.com/chrome/mobile/docs/webview/overview
Android 4.4 (KitKat) includes a new WebView component based on the Chromium open source project. ...[truncated]...., so rendering should be much more consistent between the WebView and Chrome.
As of this writing, -webkit-overflow-scrolling was exclusive to Mobile Safari on iOS 5 and later.
As of mid-2012, the latest Android version (4.1 Jelly Bean) does not support it, but it IS supported in Chrome for Android, which can be downloaded from Google Play (and only supports Android 4.0+). Android 3.0+ supports overflow: scroll, but it's not very snappy.
Referred from : How much support is there for -webkit-overflow-scrolling:touch
I'm running the same exact web app on Android under PhoneGap and under the built in Browser. The app runs fine on the built-in browser but is unbelievably slow under PhoneGap. Even basic scrolling on the page stutters under PhoneGap.
Is there anything, in general, that I might be doing wrong? I was under the impression that PhoneGap just uses the same WebKit renderer as the normal Browser app, so why would the same HTML and JavaScript run much slower inside PhoneGap?
P.S. This has been asked before, but due to wording I think the original question was misunderstood.
I may have inadvertently stumbled on an answer to this. Turns out that the apps I was working on had android:targetSdkVersion in AndroidManifest.xml set to a really low value (i.e. my target Android version was something like 2.2). Increasing this to 14 (Android 4.0) appears to have hugely improved PhoneGap performance, at least on newer Android devices running ICS or Jelly Bean.
Setting a low targetSdkVersion seems to disable at least some of the performance improvements introduced in newer versions of Android.
So, if you want to see a big performance boost in PhoneGap, make sure your targetSdkVersion matches the max SDK version supported by the phone you're testing on.
I don't know phoneGap, but you can try these:
Adding android:hardwareAccelerated="true" in the manifest
If you use webview webview.getSettings().setRenderPriority(RenderPriority.HIGH); and webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
It is counter-intuitive but you may actually need to turn off hardware acceleration for your webview. Hardware acceleration as of Android 4.0.4 does nothing for canvas and other redraw events, but actually removes CPU resources for those events.
Try adding this line of code in your app java file:
super.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Also set android:hardwareAccelerated="false" in the manifest.
Same exact thing I experienced! Previously I was using Android 3.x for testing. As soon as I upgraded to 4.4.2 my Canvas was dead slow! Looking at the Rendering timeline I could see many Rasterization calls taking over 100ms and reducing my FPS to about 8! android:hardwareAccelerated="false" solved my issues. Is there a way to set hardwareAccelerated="true" depending on android version?
I developed an application for android using jquery mobile and phonegap.
I deployed the app to my device over usb. The performance of the app ist really bad, especially while scrolling a longer list.
The strange thing is: The whole app runs smooth if i just open up the browser on my phone and access the index.html directly. Same technology, same content. I do not use the phonegap native api or anything similar.
Tested with phonegap 1.5.0 and 1.7.0rc1, jquery mobile 1.1.0 on android 4.0.2.
Any ideas?
On honeycomb (3.0), Ice cream (4.0) and posterior devices, you can boost performance by adding the following in the < Application ... > tag:
android:hardwareAccelerated="true"
You could set the minSdk to 8 (Android 2.2) for compatibility and the targetSdk to 15 (Android 4.0) and that would make hardware acceleration work when its available on the device only.
I believe that with this flag the performance of my apps is equal to running them in the browser, so I guess its because the browser was coded with hardware acceleration :)
I had a similar problem: a page with a longer list of "medium complex" themed divs. The browser of HTC phone had no problems in displaying. But within the phonegap app rendering failed completely. I saw a kind of WSOD, which disappeared only after touching the display. After touching, the page was displayed correct.
The problem was not in place, when I shortened the div-list to one or two div-elements or when I reduced the sub elements within the divs and reduced the render effort caused by the css complexity.
The white screen looked like, if the whole body was invisible, since only the documents background-color was displayed (I added a light pink for this). So I guess, the rendering was the problem after reading this thread
I tried the various proposals I found in this thread to make the app work without the "WSOD". But nothing worked. Some of them made the app displaying really worse.
Finally, after a whole day of searching, I made it. I set within the tag (not the tag) of my AndroidManifest
<application android:hardwareAccelerated="false" ...
Now the app behaves in the same fast way as my webbrowser. Seems like, if hardware acceleration is not always the best feature...
My versions:
phonegap 3.5.0, Android 4.0.3, jQuery v2.1.0, HTC Sense 3.6
Found an answer here: http://groups.google.com/group/phonegap/browse_thread/thread/94da1cf881abe995/6d4f7aea7aeba523?lnk=gst&q=performance
There is probably a difference between the native browser and the webview in terms of javascript performance.
If you can confirm the browser performs better (that it's not something suboptimal in your code frustrating one but not the other), you could consider deploying as an html5 offline application so that you will actually run in the browser.
We bumped into performance issues while scrolling the same amount of list items with jquery mobile. The performance was so poor (we didn't even try in PhoneGap environment) that we rewrote the app using iScroll library... now the app scrolls really smoothly.
If you are at the beginning of the development, you could try to change the UI library.
After this situation we deploy our apps to test devices quite often to manage performance issues in time... this became a "policy" :)