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.
Related
I am supporting a hybrid app built using IBM mobile first platform v7.1 and jQueryMobile framework in which we are facing UI element size issues on android platform. The font, button and all the other elements appearing too large on android app since last 2 weeks. However, the app was working fine few days back.This app is on google playstore and this issue persist over there as well
I don't know what has broken the app since nothing has been changed from the code perspective and its happening only on android OS version 6.0 and above. This might be an android OS version issue
Any Guidance or suggestions will be appreciated to identify the root cause or fixing the issue
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/
I'm currently developing my final year project, which is due this month, using phonegap and the most recent update to the Samsung Galaxy S4 seems to have completely disfigured everything in my application.
Has anyone come across this issue before or have any idea how to fix this ASAP?
Thanks lots,
Paula
I have come across this when using phonegap and sencha touch. First thing to do is make sure you update your app to the current version of phonegap. Typically they will release new version along side of android.
If your still getting the issues after the phonegap update. I would suggest looking into what browser it is using. Several phone manufacturers put their own flavor into the web browser which can affect your code. I previously had an issue with htc do to the browser handling css differently. Android APIs are the same, some will use different browser code so you will have to test it against each to make sure it works.
I also believe phonegap allows you to modify what browser it uses. It may default to chromium now but in the past you could switch it depending on what api version it was.
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" :)