How to Enable Flash Plugin in Webview Browser?
Asked
Active
Viewed 2.9k times
6 Answers
16
You just need to enable the plugins for the webview, like this :
WebView mWebView = (WebView) findViewById(R.id.WebView01);
mWebView.getSettings().setPluginsEnabled(true);
I think you also need Flash to be installed, like in Android 2.2 and above. Hope this helps.
This method is now deprecated, I'll try to explain this more in detail. See here

MrBuBBLs
- 459
- 6
- 15
-
1You also may need `android:hardwareAccelerated="true"` in the manifest if its apk > 3.0 – Nick Mar 29 '12 at 15:22
-
Don't know for the "hardwareAccelerated", but the method I proposed is now deprecated. [link](http://developer.android.com/reference/android/webkit/WebSettings.html#setPluginsEnabled%28boolean%29) I'll try to explain this more in detail. – MrBuBBLs Apr 05 '12 at 17:12
11
I believe that you can
WebSettings webSettings = myWebView.getSettings();
webSettings.setPluginState(PluginState.ON);
will work.

Nick Felker
- 11,536
- 1
- 21
- 35
-
3This is the correct answer, now that setPluginsEnabled() is deprecated. But the second line in your code is meaningless. All you do is setting a constant to another constant, which you get by accessing the runtime object. I suggest you remove the second line and change the third line to: webSettings.setPluginState(PluginState.ON); – Robert Sep 12 '12 at 07:39
-
Okay. I edited my sample. Thanks for the advice, sorry I'm mad late. – Nick Felker Mar 21 '13 at 20:22
1
setPluginsEnabled() and setPluginsEnabled() are deprecated.
To make Flash Player work in a WebView you need to enable hardware acceleration in your AdroidManifest.xml.
<application
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/appicon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
You can also individually enable it for your WebView by using
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);

Halil SAFAK
- 377
- 1
- 6
-
2
-
Any Fruitful solutions in 2020? these are deprecated and not working anymore – Emon Hossain Munna Dec 28 '20 at 04:53
1
webView.getSettings().setPluginState(PluginState.ON);
is deprecated now, instead use this:
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);

Stephen Rauch
- 47,830
- 31
- 106
- 135

Parimal Debbarma
- 23
- 2
0
try to use this lines of code
webView.getSettings().setPluginState(PluginState.ON);
instead of using
webView.getSettings().setPluginsEnabled(true);
Its work fine...

aizaz
- 3,056
- 9
- 25
- 57

Narendrakumar
- 163
- 2
- 6
-
1webView.getSettings().setPluginState(PluginState.ON); is deprecated in api 18 and above – KarnakerReddy Gaddampally Jun 19 '14 at 14:01
-
-3
package com.ageofwar2;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;
public class MainActivity extends Activity {
/** com.ageofwar2 */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
String url ="file:///android_asset/Flash.swf"; //AgeOfWar2.swf
WebView mWebView=(WebView) findViewById(R.id.web_engine);
webView.getSettings().setPluginState(PluginState.ON);
webview.loadUrl();

jon
- 1
- 1
-
1You should write some kind of explanation, how did you enable the flash for example – Erdi İzgi Aug 18 '16 at 18:23
-