androidwebviewwebglcrosswalk-project

WebGL in Android WebView


I know this has been asked before but those questions are pretty old now. I have a "game" that I developed some time ago with WebGL and I want to bring it to Android with a simple WebView. The problem now is, that it won't really respond to the user input in the WebView (Chrome works just fine. Android 7.1.1) . I guess that's because of WebGL.

So now, as the crosswalk-project has ended a while ago I am searching for an alternative to run WebGL in my application. Or somehow just run my "game" in an Android App.

Do you have any idea of how I could bring it to work?


Solution

  • From 5.0 Android comes with Android System WebView which is being updated and we might call it the Native WebView. WebGL should work there although some of WebGL extensions and WebGL 2 (stats) might not.

    The key to make your game work as an application is following.

    First you must identify what WebGL version, WebGL extensions, WebGL or Shader capabilities and other HTML5 functionality your game (and the game engine you use) requires.

    Then you must find a WebView that supports that functionality. You can simply do that by opening webpages https://html5test.com/ and http://webglreport.com/ with the WebView you want on your Android device. IMPORTANT! If you for example open the webpage with installed Chrome browser, it doesn't guarantee the Native WebView is used! So it is better to write a small custom application to make sure you are testing the WebView you want to use for the game.

    In the end you will probably end up with compiling your game in application with custom WebView which will add an additional size to your game.

    Other useful informations