Search code examples
androidflashandroid-webviewlocal-storageandroid-4.2-jelly-bean

Play .SWF files from internal storage in android webview in nexus 7 android


Cant play .swf(flash files) files from internal storage in android webview on jellybean installed devices (for eg:-nexus7) but i can play .swf(flash files) on android honeycomb devices... Also i figured this out as jellybean onwards android stopped supporting flash files plugin and even adobe stopped developing for the same in android.

Here is some code snippets that i tried with no results----

wv = (WebView) findViewById(R.id.webView1);
    String url =Environment.getExternalStorageDirectory()+"/FolderName/Filename.swf";
    wv.setWebChromeClient(new WebChromeClient());//also tried WebViewClient
    wv.getSettings().setJavaScriptEnabled(true);
    wv.getSettings().setPluginState(PluginState.ON);
    wv.getSettings().setAllowFileAccess(true);
    wv.getSettings().setUseWideViewPort(true);
    wv.loadUrl(url);

only a small icon is shown at the centre of webview. [Note- i have even tried to load using html file but nothing worked]


Solution

  • I found a workable solution...dont know how feasible it is but this solution works for me follow this steps..

    Step1->Download flash player apk from this
    

    Link to download Flash Player apk

    Step2->After downloading go to settings--->security---->Check "Unkown sources option".
    
    Step3->install the apk that you downloaded+
    
    Now your webview code will work and .swf files can be played inside webview
    

    [note-download flashplayer apk for android 4.0 devices for ics and above].