Reputation: 6433
I am building a canvas based web game that runs at 60fps in chrome on the desktop. It also runs at 60fps in chrome on android. I loaded it into a phonegap application and the fps meter still reads 60fps, but the screen is only getting drawn every few ticks. Is there a refresh rate limiter that is forcing the webview to only draw every once a second or so? What other things could be limiting my drawing, even when the website says its redrawing at 60fps?
Upvotes: 2
Views: 3017
Reputation: 1835
Sadly, the new Webview does not have all the same features as Chrome. One of these differences is the WebGL 3D canvas that Chrome uses. See here for a list of feature differences between the new Webview and Chrome.
Upvotes: 1
Reputation: 3467
PhoneGap by default will use the built in default browser, which is not chrome, unless you are working with KitKat, but that is a different story.
Now I had problems myself with the default browser even on small canvas project like getting a user signature, but that was due to low rate of touchevent fires...
Anyway the possible solution will be to force phonegap to use WebChromeClient instead of the default one, you can do that by adding following line before the super.loadUrl
call:
appView.setWebChromeClient(new WebChromeClient());
If you do force to use WebChromeClient make sure you do enable javascript, local storage if you need it and so on. Also it's possible that some PhoneGap plugins will break. If you game is pure HTML5 than I suggest considering not using phonegap for your android version, building a simple WebView app it is quite easy in Android.
Also if your game intend to use acceleration sensor, have a look at what is the native support for browsers: Can I Use resources
Also I will definitely read THIS and THIS
Hope it helped. Emil
Upvotes: 6