I installed Adobe Flash Player apk by copying it from assets to SD card and installing it using Intent. Even after that, webView is not able to load the .swf file.
Should i use Adobe Flash builder instead to develop the Android application. My primary requirement is to play .swf files from the server!
Here is my code.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_flash);
installFlashPlayer();
//Fake Url
// String url = "http://www.test.com/test.swf";
//
// webView = (WebView) findViewById(R.id.webView);
// webView.getSettings().setPluginState(WebSettings.PluginState.ON);
// webView.setWebViewClient(new WebViewClient());
//
// webView.getSettings().setUseWideViewPort(true);
// webView.getSettings().setLoadWithOverviewMode(true);
// webView.loadUrl(url);
}
void installFlashPlayer(){
AssetManager assetManager = FlashActivity.this.getAssets();
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open("flp.apk");
out = new FileOutputStream(Environment.getExternalStorageDirectory() + "/flp.apk");
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
in.close();
in = null;
out.flush();
out.close();
out = null;
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/flp.apk")),
"application/vnd.android.package-archive");
startActivity(intent);
} catch(Exception e) { }
}