In his presentation at the Google Chrome Dev Summit in Mountain View CA, Matt Gaunt talked about the change in Android's WebView from WebKit for Android to Chrome. Here are my notes from his talk:
- The WebView in Android 4.4 now uses Chrome. It scores 424 out of 555 in the HTML5 Test. Included in the Chrome WebView is: IndexDB, Request Animation Frame, SVG Filters & Effects, Web Sockets, and more.
- We want live reload in our workflow. Grunt is a Javascript task runner: it can compile SASS, optimize CSS, etc. Gradle is kind of a similar tool in the Android SDK. Bringing them together helps simplify the workflow of native apps withe Web code. You can use Chrome Dev Tools just as you do on the desktop.
- The old Android WebView is still around and does not support Web Sockets (so no live reload) nor does it support Chrome Dev Tools. You can still use Wienre for older Android WebViews.
- To call out of WebView into native code you can use @JavascriptInterface. The old WebView does not support evaluateJavascript, which is faster. When you use native features, you need to be aware of what is supported in different versions of Android.
- What should we be concerned about when it comes to design? Each platform has a set of native components. Web apps can fall into the uncanny valley of trying to emulate native components. If you want the native components, build native apps.
- Web apps are generally going to use Action bars and tabs, which frame the app -use native components for these instead of re-creating in the WebView.
- Web apps ned some custom markup to remove things like tap highlight colors and user-selection to disable browser tools and conventions. Frameworks should be able to cover these things for us.
- Target Android SDK version 19, that uses KitKat and set Web content debugging to true in order to turn on Dev Tools in the new Web View.
- In the future, the old WebView will still be the predominant version. So it will still need to be supported. Updates of the WebView are still tied to Android releases -the team wants to change this but it needs to figure out.