Os navegadores do android WebView suportam funcionalidades do html5?

Tenho uma aplicação web baseada em HTML5 que quero que se integre com a WebView, tal como os navegadores do android WebView suportam as funcionalidades do html5?

Author: Devendra Shewale, 2012-05-15

4 answers

A WebView apoia-os, mas tens de Os ligar. Eu uso o seguinte código que liga todas as características que estão disponíveis. Isto é necessário porque Caches de aplicação, por exemplo, não são suportados em todas as versões Android:

    wv = (WebView) findViewById(R.id.webview);
    WebSettings ws = wv.getSettings();

    ws.setJavaScriptEnabled(true);
    ws.setAllowFileAccess(true);


    if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.ECLAIR) {
        try {
            Log.d(TAG, "Enabling HTML5-Features");
            Method m1 = WebSettings.class.getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
            m1.invoke(ws, Boolean.TRUE);

            Method m2 = WebSettings.class.getMethod("setDatabaseEnabled", new Class[]{Boolean.TYPE});
            m2.invoke(ws, Boolean.TRUE);

            Method m3 = WebSettings.class.getMethod("setDatabasePath", new Class[]{String.class});
            m3.invoke(ws, "/data/data/" + getPackageName() + "/databases/");

            Method m4 = WebSettings.class.getMethod("setAppCacheMaxSize", new Class[]{Long.TYPE});
            m4.invoke(ws, 1024*1024*8);

            Method m5 = WebSettings.class.getMethod("setAppCachePath", new Class[]{String.class});
            m5.invoke(ws, "/data/data/" + getPackageName() + "/cache/");

            Method m6 = WebSettings.class.getMethod("setAppCacheEnabled", new Class[]{Boolean.TYPE});
            m6.invoke(ws, Boolean.TRUE);

            Log.d(TAG, "Enabled HTML5-Features");
        }
        catch (NoSuchMethodException e) {
            Log.e(TAG, "Reflection fail", e);
        }
        catch (InvocationTargetException e) {
            Log.e(TAG, "Reflection fail", e);
        }
        catch (IllegalAccessException e) {
            Log.e(TAG, "Reflection fail", e);
        }
    }
 40
Author: theomega, 2012-05-15 11:30:59

No seu navegador android abra esta ligação: http://html5test.com ele dar-lhe-á toda a informação de que necessita : regras de processamento , tela ,Vídeo,Áudio,elementos,formulários,webapp...

 8
Author: moujib, 2012-05-15 11:32:17

Thanks @theomega I used the following way to enable using light touches to make a selection and activate mouseovers.

try {
    WebSettings.class.getMethod("setLightTouchEnabled", new Class[]{Boolean.TYPE});
} catch (SecurityException e) {         
    e.printStackTrace();
} catch (NoSuchMethodException e) {         
    e.printStackTrace();
} 
 2
Author: Devendra Shewale, 2012-07-04 08:04:48

Você não especificou quais recursos você está procurando exatamente,
mas Android (e iOS) usam Webkit. Então, sim.

 1
Author: Andy, 2012-05-15 11:28:21