Posted by the Chrome OS team
From releasing our first-ever tablets and detachables to launching Chromebooks in new markets like Japan and Germany, we’ve worked hard to adapt the ecosystem of Chrome OS devices to today’s app users. And as people increasingly use apps on devices with larger screens and versatile form factors, we’ve been able to engage a huge new group of users.
Android powers a growing variety of large-screen devices, from tablets and foldables to Chrome OS laptops. Because Chromebooks specifically run a full version of the Android framework inside a container, most Android apps already run on Chrome OS. That means devs can take their single Android APK and scale it to work on any Chrome OS device, allowing for even more immersive and engaging experiences on devices with bigger screens.
Devs can take their single Android APK and scale it to work on any Chrome OS device, allowing for even more immersive and engaging experiences on devices with bigger screens.
Total time spent in Android apps on Chrome OS has also grown 4X in the last year,¹ and in Q4 2018, 21% of notebooks sold in the U.S. were Chromebooks — a 23% YoY growth.²
Delivering an optimal experience on Chrome OS only takes a few tweaks, but they make a major impact. After Gameloft and TopHatch optimized their apps for larger screens, Gameloft’s Asphalt 8: Airborne drove 6X more daily app users and 9X more revenue on Chrome OS devices, while TopHatch has seen twice as many paid conversions on Chromebooks and 20X more time spent on Pixelbooks for its Concepts app.
At I/O this year, we broke down some helpful steps to ensure your app will look and work great across a variety of form factors and screen sizes. Check out the highlights below along with a couple exciting new updates for Android developers in Chrome OS.
Optimizing your app experience for Chrome OS
The way someone uses your app depends entirely on his or her device. There are a few things you should consider to ensure your app delivers an optimal user experience:
If your app doesn’t already support keyboards, here’s the code to make sure it does:
The highlighted portion is a way to pass unused keys up to super. This allows Chrome OS to handle those commands rather than negate the functionality of every unassigned key.
The Chrome OS keyboard has a special refresh key with its own keycode (KEYCODE_REFRESH), so make sure your app can handle KEYCODE_REFRESH events. If you’re already using SwipeRefreshLayout, Chrome OS is wired to ensure that layout will work automatically with the refresh button.
When someone’s using your app on desktop with a touchpad, they’ll expect to scroll with a two-finger touchpad swipe. But on mobile, users typically scroll by holding and dragging the screen. Chrome OS automatically interprets these types of different motion events so, for example, a drawing app won’t mark on the screen when someone tries to scroll on mobile.
For apps that require more advanced touch motion events, you can use ignore MotionEvents when (event.getButtonState() == 0) to check the button state and ignore undesired events (as in drawing app example above).
Games and apps on Chrome OS automatically receive ARM to x86 translation. But if performance is your priority, it’s essential to support x86. Most of the top Chrome OS devices have 64-bit x86 chipsets and more are on the horizon. To provide the best performance and support across all devices, be sure to provide ARM, ARM64, x86, and x86_64 build targets if you have native code.
Android Studio makes supporting this simple: Using Android app bundles, it packages all your build targets up ready for the Play Store, which then only sends the build targets your app users need to keep download sizes at a minimum.
You’ve probably seen a mobile app that hasn’t been designed for a larger screen — lots of wasted space and clunky navigation. To ensure your app looks great on several layouts, you can use one resource file with multiple layout buckets for each screen size.
Your app should also be easy to use on different screen sizes. Build for portrait, landscape wide portrait, and wide landscape layouts by switching between a bottom navigation, side navigation, and expanded side navigation pattern, depending on the available screen width.
Reply, an email app, redesigned its layout for functionality and ease-of-use on multiple screens, and while Adobe Acrobat optimized its app functionality for Chrome OS, the brand also redesigned its entire layout for different devices.
When someone uses multiple monitors, there will typically be a density difference between the two screens. Change your app density on the fly by listening to “density” onConfigurationChanged changes inside your Chrome activity.
New updates for developing on Chromebooks
At I/O, we also announced more ways we’ve made Chrome OS a faster, simpler, and more secure environment for Web and Android developers, including:
One-click installation for Android Studio
Just download, click, and install — no more using a terminal.
Improved ADB over USB debugging
No more developer mode — simply plug in your phone and debug via USB on supported devices.
Highlights locked or unfriendly orientations, non-resizable activities, incorrect hardware requirements, and other features that aren’t ideal for Chrome OS.
Audio playback in Linux
The Chrome OS container supports all audio tools from Linux, such as Audacity.
A flag in M76, our current stable channel, enables turning on a virtual desktop when your screen gets clogged with different windows and platform use cases.
Multi-monitor/full HDCP support
Project and watch DRM-protected video content on external monitors.
*Use the SurfaceView.setSecure() to take advantage of this feature
ARCore is available to applications with a world-facing camera.
Instant app support
Users on Android P devices can now try an app or game without installing it first.
External storage for Android apps
External discs can be read and scanned by Android apps.
The file manager from Chrome OS can show the /sdcard folder from Android under play files, enabling access to read and write Android files from the Chrome container.
Android Cloud storage with DocumentsProvider and Custom document provider apps
Support for the Android DocumentsProvider interface in Chrome OS.
Profiling your app to detect animation jank
An integrated profiling tool allows devs to monitor system status over time — including buffer use, v-syncs, CPU use, GPU and CPU frequency, and system temperature — to see what’s causing animation jank and/or system slowness.
Deliver an optimal experience on every screen
The app experience has expanded far beyond mobile. In an era of versatile devices and variable form factors, users will expect a well-designed, user-friendly experience every time they open your app. Take advantage of the opportunity to support various input methods, optimize your layout and navigation for a variety of screen sizes, utilize extra screen real estate, and support x86 with native code.
If you’d like to hear more about building Android apps for Chrome OS, check out our full session from I/0 2019.
¹ Google Internal Data, March 2018 to March 2019.
² The NPD Group, Inc., Retail Tracking Service, U.S., Notebook Computers, Chrome OS, based on units, Oct. 8, 2017- Jan. 6, 2018 vs. Oct. 7, 2018- Jan. 5, 2019.