Solving Android Fragmentation with Trigger.IO Forge and Intel’s Crosswalk
The State of the Hurt
Anyone developing for Android will be all too familiar with the compatibility issues that come up when trying to run apps on older Android devices. Historically, even the act of porting an app from a desktop browser environment to Android has been fraught with issues as the Android WebView lacked many basic HTML5 features and suffered from implementation problems.
While Google did much to rectify this after they started shipping a Chrome based WebView with Android 4.4 the reality is that, at the time of writing, Android 4.4 or higher devices still only account for 44.2% of the marketplace.
The remainder is made up of 7.3% devices still running Android 2.x while a massive 48.5% of devices are still running some version of Android v4.x with various non-Chrome versions of the Android WebView.
Finally, if you thought it couldn’t get any worse… even if we assume that at some point in the future we have a majority of devices running 4.4 or higher there is STILL no guarantee that your app will run smoothly across Android versions as it is entirely up to the vendor whether a given device will be receiving regular updates of the System WebView!
Against this background it therefore gives me great pleasure to announce that we have integrated Intel’s Crosswalk technology with Trigger.IO.
Starting from today your Forge apps only have to target a single web runtime for Android which covers 92.7% of all Android devices while retaining full access to all of our Forge API’s.
What is the “Crosswalk” Forge target?
Android versions before v4.4 shipped with a proprietary System WebView which lacked many basic HTML5 features, performed poorly and suffered from compatibility issues.
Android versions higher than v4.4 use a Chrome-based System WebView which, in turn, is based on the open-source Chromium code base which closely tracks HTML5 implementation standards.
Up till now, developing hybrid apps under Android meant that your app would be hosted by whichever System WebView shipped with the device forcing developers to take a “lowest-common-denominator” approach and spend an inordinate amount of effort to ensure rendering compatibility.
What the Forge
crosswalk target does is to embed a build of the latest versions of the open-source Chromium WebView directly within your Forge application, allowing your app to execute in a uniform environment irrespective of the System WebView shipped with a particular device.
This means your app will behave exactly the same no matter which Android device it is running on!
How well does Crosswalk perform?
Apart from the tangible benefits that come from being able to target a uniform WebView, the Forge
crosswalk target also provides significant performance improvements over all versions of the Android WebView, even those based on Chrome.
We checked a variety of Android devices against the HTML5TEST Benchmark for HTML5 conformance and found some interesting results:
VERSIONS OF ANDROID OLDER THAN v4.4
The older devices showed the most significant improvements over the default System WebView, in all cases exceeding even the iOS System WebView in compatibility scores.
VERSIONS OF ANDROID FROM v4.4 AND UP
Our biggest surprise from HTML5 conformance testing was the marked improvement we saw even for devices that shipped with a Chrome-based System WebView. Even the latest Chrome-based System WebView scored a couple points lower than Crosswalk. We attribute this to the fact that Crosswalk are able to more rapidly integrate and ship improvements from the upstream Chromium project.
CROSSWALK SCORE VARIATIONS
Something else we noticed was that there was some variation in crosswalk scores between devices. Closer investigation showed that, in all cases, the variation came down to the following HTML5 features which required hardware support:
- WebAudio is only available on ARM devices that support NEON optimizations which were introduced with the ARM Cortex-A8 processor.
- Newer Video Codecs require specific hardware support for decoding which is not present in some older Android devices. Our recommendation is that if you are in doubt, use H. 264 as support is a requirement for all Android devices on the market.
- Support for the universally loathed DRM and Media Source extensions are tied to Video Codec support and may therefore not be available on some devices.
Again, the advantages of crosswalk are evident even on newer devices where we see an 8% improvement on identical Nexus 7 hardware between the older Chrome-based WebView on Android 4.4.3 vs Android 5.0.2.
How do I use it?
Crosswalk is currently in Open Beta and can be accessed by changing your App’s platform_version to
v2.3.1beta-3 and using the
crosswalk target rather than
- Open your application’s
src/config.jsonfile in an editor and set the
platform_versionkey’s value as follows:
- Run your app from the Toolkit using the
Crosswalkbutton or from the command-line with:
12forge build crosswalkforge run crosswalk
This is a Beta release so please don’t be dismayed if you run into issues. We’ll be standing by at firstname.lastname@example.org to answer any questions you may have!
When will it enter the stable platform branch?
The Crosswalk target is the biggest change we’ve implemented since the release of Android 4.x and the Crosswalk project itself is still under heavy development so we’re going to be holding off a bit on pushing it to the stable
v2.2.x release stream until everyone’s had a chance to try and break it!
To track release information you can go to: Forge Beta Release Notes
How much will it cost?
Integrating Crosswalk into Trigger.IO Forge has been a major engineering challenge which we’ve invested a lot of time, money and resources into.
Because of this, we did toy with the idea of making access to crosswalk exclusive to our Go Pro or higher customers as a way of recouping our development cost.
That said, our philosophy has always been to provide all of our customers with access to the best tools for Hybrid App development.
Our experience with Crosswalk is that it falls into that category of game-changing technology which everyone should have access to.
Therefore, we made the decision to make Crosswalk available, at no extra charge, to all of our customers irrespective of the plan they are on.
What about my custom modules?
We’ve been able to maintain binary compatibility with the vast majority of Forge modules and it is likely your modules will continue working “as is”.
If you have a custom module which is behaving strangely under Crosswalk please contact us at email@example.com and we’ll be happy to assist you with any changes that may be required.
Crosswalk also offers a more rapid release cycle than the Android System WebView and continues to bring new HTML5 features and performance improvements to your app even on devices which are no longer supported by vendor updates.
With Crosswalk you are now also able to take advantage of many new HTML5 standards and features which, in the past, had to be avoided due to compatibility concerns, including:
- 3D CSS Transforms
- Date/Time input types
- Multiple file selection
- Raw Sockets
We feel that the integration of Crosswalk marks the beginning of a new era for our Forge standards-based Hybrid App Runtime and look forward to making the new capabilities developed by the W3C over the last few years available to all of our users.
Happy hacking everyone!