开发者

Load Flash plugin after it's been installed on Android

My android app is my website loaded into a WebView. Flash is required to view the videos on my website, so I use Javascript to put up a download prompt when Flash is not detected:

Load Flash plugin after it's been installed on Android

When my site is viewed through the stock Browser app, all the user has to do is refresh the page to instantiate Flash. But this doesn't work on my WebView app. No matter how many times I reload or reset the plugin state, Flash does not instantiate.

protected void onRestart() {
   super.onRestart();
   this.webView.getSettings开发者_运维问答().setPluginState(PluginState.ON);
   this.webView.reload();
}

The user is forced to kill the app and restart it for Flash to instantiate. This is a poor user experience, as regular users don't understand memory management. For the best experience, I would like to programatically instantiate Flash for the user after it's been installed. How would I do this?


When you start your WebView you should get the WebSettings object and setup all the attributes about your WebView. From there you can enable/disable many things. For your case, if you want to enable plug-ins just do this:

Get the settings from you WebView... WebView webView = new WebView(this); WebSettings webSettings = webView.getSettings();

And enable it... webSettings.setPluginsEnabled(true);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜