I am having a problem that only happens on my Motorola Xoom which I have updated to 3.2 through OTA. I have a simple application that uses a WebView to load a small html that has flash content in it. Here is the code snippet.
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
I know it is correct because it can run fine on my Samsung Galaxy S running Android 2.2. Anybody else seen this problem? Any idea how I can solve this problem?
Many thanks and I am really stuck here.
Try to build your application with the latest android Api (13), and activate hardware acceleration (same link, just a little below) on your activity that need to display flash.
Related
I am facing an issue in WebView in devices running API 27 (8.1.0).
I pass off my params in the userAgentString based on which a php page loads the appropriate data. When I open the WebView for the first time it works well.
However, whenever I open the WebView after this first time (I call setUserAgentString each time I load it, with fresh values), it persists with that old value of userAgentString, thus not loading the correct data. This happens irrespective of whether I am in the same activity and re-using the same WebView, or move to a different activity where a new instance of WebView is used.
The following devices gave this odd behaviour -
Google Pixel 2XL, version 8.1.0
Xiaomi Mi A1, version 8.1.0
...and the webview was working perfectly on the following devices, not showing this behaviour -
Samsumg GALAXY Tab SM-T825, version 8.0.0
Moto G4, version 7.0.0
HTC Desire 526, version 4.4.2
I think this could be linked with how the Android Webview implementation has been changed to Chrome in Oreo.
However, the behaviour did not change irrespective of what I set as "Webview Implementation" in Developer settings, implying that may not be the cause.
Additionally, only when I clear data, or do a fresh install, is the userAgentString value reset.
I have read dozens of posts on SO, and tried all sorts of methods related to WebView and WebSettings, but I haven't managed to find a solution.
What am I missing here?
Maybe, this code can help you.
webView.clearCache(true);
webView.clearHistory();
webView.getSettings().setAppCacheEnabled(false);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
Lucky :)
I experienced this issue recently and the problem was that the device had an outdated Chrome WebView framework. Simply update it via the Play Store and the issue should resolve.
Community, I hope you can help me, I need to see my webview as http://www.templatemonster.com/es/demo/44836.html flash and related pages .
https://play.google.com/store/apps/details?id=com.nambudenki.android.fow&hl=es and try to install flash player 11 .
I tested also placing android:
hardwareAccelerated = "true " on the manifest
mWebView.getSettings().setPluginsEnabled (true);
this deprecated and
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON); It does not work either .
I conducted tests in a kit kat LG G2 with 4.4.2
I hope you can help
Check following link it may help you for 4.1 and earlier.
Flash is not loading in Web view in Android .
After 4.1 support of flash is deprecated.
But you can use Dolphin browser to run webpages. But can not do so in webview.
The android app that i'm building has a webview that loads a mobile website. On most phones the webview loads perfect but on some phones with android 4.4.2 the webview loads perfect the first time but when you open the app after you paused or closed it it will just show a white screen.
Now the question is - what am i doing wrong and why is this problem only on some devices?
I had the same issue - but with different Android versions.
For me adding the following helped. Still investigating if I can narrow down the phones for which this is necessary.
webview.settings.apply {
cacheMode = WebSettings.LOAD_NO_CACHE
setAppCacheEnabled(false)
}
It's Kotlin obviously.
Enable the WebView cache by using the following properties:
webview.getSettings().setAppCacheMaxSize(1024*1024*8);
webview.getSettings().setAppCachePath("/data/data/com.your.package.appname/cache");
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
i am loading the following URL in to a WebView:
http://crm.unitask-inc.com/dotproject/DP/
in android v4.x it works fine.
in android 2.x when i try to enter text in to the text fields.
the keyboard shows up and i can heare the ticking while typing.
i but no text is entered to the text box.
I tried to set the focus of the WebView, but it didn't help.
Any ideas?
Thanks a lot
Avi
It's not problem with Android 2.x. It's problem with "Https" url in android 2.x
May this help you....
Android soft keyboard hides inputs from CordovaWebView when in fullscreen
I don't think there is a bug with WebView for your issue. I'm currently using it with 2.2 to 4.3 versions of devices and I never had a problem as you described.
You can test it with an url like google to define your problem again. As I see problem comes from your page at url http://crm.unitask-inc.com/dotproject/DP/
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
setContentView(webView);
webView.loadUrl("http://www.google.com");
}
BTW, I've tested google's url on 2.2 Nexus One (Emulator) Device. Didn't have any problem there.
Edit: I've tested your url on 2.2 Nexus One (Emulator) Device and 4.3 Galaxy Nexus device. They only showed 3 blinking dot on a blue page. Never saw the entry page.
android:windowSoftInputMode="adjustResize"
For more info refer this answer.
I've experienced a LOT of strange behaviours with using WebView in Android and I'm wondering why there are so many diffrences between the WebView and the Browserinstalled on each phone?
As an example, I've developed some applications that had to display HTML content, which contained either jquery-mobile, flash,javascript, YouTube embedded and so on. So I had a lot of problems with displaying this pages inside WebViews. Either they wouldn't get displayed at all, just blank, either the videos won't play and so on. And the strange thing is that they work properly if opened in the Browser installed on the phone. I had JavaScript enabled, I tried diffrent WebSettings, I had set the WebChromeClient and WebViewClient looking for javascript errors... but nothing worked.
So I got to the conclusion that the WebView component is completely different from the Browser application installed on the phones. I'm thinking that every manufacturer makes their own Browser to support as many as possible pages, and the WebView remains the standard one, included in the Android SDK.
Am I right? Or there is another reasons/explanation for this?
Thanks.
EDIT: Everything that #ondoteam has suggested was enabled and set at the time being. I no longer have the references to that websites, which anyway were internal.
This article outlines your speculation about stock browser differences between manufacturers, that absolutely is true: 5 reality checks every team needs before working on Android webkit
...which does cause trouble and mysterious/difficult to diagnose/solve problems.
As far as your issues with your WebView implementation:
Version of jquery-mobile may be an issue jquery-mobile loaded into an android WebView if you are using jquery.mobile-1.0.1.min.js you may want to try the uncompressed jquery.mobile-1.0.1.js
And Flash :-/ Good luck:
Screen blinking when using a webview with flash
Flash in WebView not working on Android 3.2
Flash video not displaying in WebView for Android 3.0.1
For loading SWF:
Load an SWF into a WebView
loading flash files (.swf) webview in android
Good luck with that, seems like a lot of variables with devices, Android versions, etc. And will take persistence with trial/error.
The stock browser and WebView differs .Using all the tweaks like
WebView browser;
browser.clearFormData();
browser.clearHistory();
browser.clearCache(true);
browser.getSettings().setAppCacheEnabled(true);
browser.getSettings().setDatabaseEnabled(true);
browser.getSettings().setDomStorageEnabled(true);
browser.setWebChromeClient(new WebChromeClient());
still it does not load high resolution images properly which is being loaded perfectly well by the android browser.
Only part of the image can be visible on the webview screen which appears fully on normal android browser.
This behavior is observed with latest Android 4X SDK as well.
Which means android default browser significantly tweaks the webkit/webview code to show any url
WebView by default is restricted. You should call setWebChromeClient and family to have a decent browsing experience. In addition, don't forget setJavaScriptEnabled() and other similar stuff. Sorry for my brevity... I think that you don't need examples.
http://developer.android.com/reference/android/webkit/WebView.html
have you checked this question : jquery-mobile loaded into an android WebView
it might be that you're using the wrong libraries. Just check in any case.