可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I am developing a flash application in phonegap for android.
I have tried to embed the flash in html but of no luck. Its showing blank and nothing comes up.
I then tried to use childBrowser, the childbrowser opens up but still a blank screen.
Can you please guide me how should I proceed so that i can play swf file. The swf is playing fine in the android browser but it doesn't play when I open up through childBrowser.
Do you have any idea?
THanks in advance
回答1:
You may have to enable the Flash Plugin for the WebView that phonegap runs in.
You'll have to download the PhoneGap source and recompile it using Eclipse or whatever java environment you'd use.
In DroidGap#onCreate add the lines to activate plugins:
WebSettings settings = appView.getSettings(); settings.setPluginState(PluginState.ON); // Turn Flash plugin on
Phonegap doesn't support this officially as Apple does not support Flash. Furthermore it has been announced that Adobe is going for HTML5 in phones and not investing further into Flash on mobile.
Similar question here: flash plugin for phonegap
Google Group topic: https://groups.google.com/forum/#!topic/phonegap/s3xZ8qxTL-M
回答2:
The solution from Vigrond's answer does no longer work: as of Cordova 1.6 the PluginState symbol seems to be gone. I did not investigate this further, but found the following solution to work:
super.init(); super.appView.getSettings().setPluginsEnabled(true);
I placed this inside my app's onCreate
method.
Originally found here.
回答3:
I know this is an old post, but it helped me, and i fell the need to contribute.
Vigrond's answer no longer works, but it can give us a clue about what to do.
DroidGap is Deprecated
/** * This used to be the class that should be extended by application * developers, but everything has been moved to CordovaActivity. So * you should extend CordovaActivity instead of DroidGap. This class * will be removed at a future time. * * @see CordovaActivity * @deprecated */
So, go to the CordovaActivity class and add Vigrond's snippet:
WebSettings settings = appView.getSettings(); settings.setPluginState(PluginState.ON); // Turn Flash plugin on
And add some imports:
import android.webkit.WebSettings; import android.webkit.WebSettings.PluginState;
This may do the trick for now.
Best regards y'all.