BabylonJS scene in WebView (Android Studio)?

Hi, Im new to Android Studio and I tried to load a basic babylonJS scene using the WebView control available in Android Studio, I saw that it loads regular websites with no problem but is not loading the babylon 3d scene.

How can I show a babylon scene (from an external url) in my Android Studio app?

Just in case I’m using this scene to test:
http://wilawara.000webhostapp.com/demos/appareldemo/

Thank you all.

Could you try following those steps:

I recall Javascript is not enabled by default (not sure if it is still the case)

Something like that should work:

        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setDomStorageEnabled(true);
        webSettings.setDatabaseEnabled(true);
        webSettings.setAllowFileAccess(true);
        webSettings.setAllowFileAccessFromFileURLs(true);
        webSettings.setAllowUniversalAccessFromFileURLs(true);
        webSettings.setMediaPlaybackRequiresUserGesture(false);

wow, thank you both for your fast assistance. I’ll try the suggestions and let you know.

2 Likes

Adding the line:
webView.getSettings().setJavascriptEnabled(true);

Solved the issue and now I can use my babylon scene

Thank you very much

1 Like