Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android on Chrome OS: What you need to know! @D...

Android on Chrome OS: What you need to know! @DroidConNYC2018

With the Play Store out of beta on ChromeOS and exciting new desktop form factors being released like the Samsung Dex Station, it’s time to start thinking about how your application performs on these new form environments.

In this talk we’ll go what Android on Chrome OS looks like, the tools available to you as a developer, and how to handle some of the major use cases and challenges in these new environments such as being free-form resizable, new first-class input methods, as well as others to help you reach more users with an even better experience.

Kenneth Ford

August 29, 2018
Tweet

More Decks by Kenneth Ford

Other Decks in Programming

Transcript

  1. • Multiple different form factors • Productivity • Re-use apps

    you’ve already built • Android brings easier offline support • Chrome OS update cycle is fast Why?
  2. • Most apps will be installable with no work •

    Require as few features in your manifest as needed ◦ Many devices don’t have GPS, rear cameras, accelerometers and other sensors. • Check for feature availability at runtime • Optimize for the platform! Why Maybe?
  3. • Target API Level 23 or higher • New 1st

    class input methods ◦ Keyboard ◦ Mouse/Trackpad ◦ Stylus • Multi window environments and larger screens ◦ More on this later! Optimize?
  4. yourView.setOnHoverListener{ _, motionEvent -> when (motionEvent.actionMasked) { MotionEvent.ACTION_HOVER_ENTER -> {

    //UI Change } MotionEvent.ACTION_HOVER_EXIT -> { //revert } ... } } Mouse/Trackpad Right click support Hover actions
  5. yourView.setOnGenericMotionListener { view, event -> if (event.actionMasked == MotionEvent.ACTION_SCROLL) {

    //scroll action } ... } Mouse/Trackpad Right click support Hover actions Scroll events
  6. yourView.setOnGenericMotionListener { view, event -> if (event.actionMasked == MotionEvent.ACTION_SCROLL &&

    KeyEvent.metaStateHasModifiers( event.metaState,KeyEvent.META_CTRL_ON)) { //ctrl + scroll action } ... } Mouse/Trackpad Right click support Hover actions Scroll events
  7. yourView.setOnGenericMotionListener { view, event -> if (event.actionMasked == MotionEvent.ACTION_SCROLL &&

    KeyEvent.metaStateHasModifiers( event.metaState,KeyEvent.META_CTRL_ON)) { //ctrl + scroll action } ... } Mouse/Trackpad Right click support Hover actions Scroll events
  8. yourView.setOnKeyListener { _, _, keyEvent -> if (keyEvent.keyCode == KeyEvent.KEYCODE_ENTER)

    { //submit form } … } Keyboard Navigation Actions on key-press
  9. override fun dispatchKeyShortcutEvent( event: KeyEvent): Boolean { if (event.keyCode ==

    KeyEvent.KEYCODE_Z && event.hasModifiers(KeyEvent.META_CTRL_ON)) // undo action return true } return super.dispatchKeyShortcutEvent(event) } Keyboard Navigation Actions on key-press Shortcuts
  10. • Layouts for larger screens • Handling both orientations •

    Free form window resizing Window Management
  11. • Layouts for larger screens • Handling both orientations •

    Free form window resizing • Use window size not screen size! Window Management
  12. • Layouts for larger screens • Handling both orientations •

    Free form window resizing • Use window size not screen size! • Drag and drop Window Management
  13. • What happens? ◦ Configuration change occurs when crossing layout/view

    boundaries ◦ onDraw() called constantly • Just like orientation changes, but more frequent • Save and restore state process must be fast • Architecture components help make this easier! What is Free-form Resizing?
  14. • Chrome OS Emulator ◦ Preview • ADB over USB

    ◦ Pixelbook & HP Chromebook X2 ◦ More information on it’s way • Android Studio on Chrome OS ◦ Preview only for Pixelbooks currently Developer Tools
  15. • Codelabs ◦ Optimize for Android on Chrome OS ▪

    https://codelabs.developers.google.com/codelabs/optimized-for-chromeos/ ◦ Resizing ▪ https://codelabs.developers.google.com/codelabs/chromeos-resizing/ • Documentation ◦ https://d.android.com/topic/arc/ • Google I/O 2018 presentation ◦ https://www.youtube.com/watch?v=6kIZ_u4QE9U • Blog Posts ◦ https://medium.com/google-developers/search?q=android%20chrome%20os Resources