The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
There has been a long-standing goal in some circles to allow Android devices to serve as desktop or notebook replacements, through the use of accessories. One of the first forays in this area was 2011’s Motorola Atrix, which offered a notebook-style docking station that allowed the Android device to be used with the dock’s keyboard and 11.5" display.
In recent years, Samsung has made a renewed push in this area, in the form of Samsung DeX.
The original 2017 DeX was a desktop docking station for the Galaxy S8/S8+ that provided power, an Ethernet jack, USB ports, and an HDMI port.
Figure 1086: Samsung DeX, Front Top Showing Device Connector
Figure 1087: Samsung DeX, Rear Showing Ports
When docked, the Samsung phone would switch into a “DeX” mode that offers a freeform multiwindow experience. In this mode, the touchscreen is turned off, and the user navigates the windows using a keyboard and mouse (USB or Bluetooth), as with a traditional desktop OS.
Figure 1088: DeX Mode, Showing Freeform-Style Windows
In 2018, Samsung introduced the DeX Pad, which not only offers power, USB ports, and an HDMI port, but also allows the Samsung phone to serve as a touchpad for navigating the DeX environment:
Figure 1089: DeX Pad, Connected to an LCD Panel
The DeX Pad and original DeX dock now work with a variety of high-end Samsung devices, including:
On the whole, developers do not seem to be concerning themselves too much
with DeX — for example, as of early August 2018, there were exactly
two questions on Stack Overflow in the
That being said, the DeX is an interesting
demonstration of Android’s freeform multi-window mode. Plus, it
is yet another environment that puts keyboards and mice
“front and center” for users and, by extension, app developers.
The user has two choices when docking their device in the DeX: screen mirroring mode and DeX mode.
What Samsung describes as “screen mirroring” mode is pretty much what you would
expect from an Android device connected to an HDMI display. By default,
the contents of the touchscreen are mirrored on the HDMI display. And, if you
use things like
Presentation, you can display separate content
on the HDMI display from what is shown on the touchscreen.
However, this mode may not be very popular, for one simple reason: the device
is docked in the DeX in portrait mode. This means that the content shown on the
HDMI device, by default, is in portrait mode. While you could lock your activity
to landscape mode, so its
Presentation appears in landscape, then the activity
is in the wrong orientation on the touchscreen.
Also, screen mirroring mode does not seem to be available with the DeX Pad.
More often than not, if people are bothering to put their devices in a DeX, it is to use Dex mode, with freeform-style windows.
This uses Android’s official freeform multi-window support. In theory, the experience should be somewhat reminiscent of how Android apps behave on Chrome OS, which also uses freeform multi-window.
Activities that are not resizeable will appear in portrait mode by default:
Figure 1090: Non-Resizeable Activity on DeX in Portrait
There is an icon in the title bar that allows the user to rotate the window to landscape:
Figure 1091: Non-Resizeable Activity on DeX in Landscape
Activities that are resizeable — the
android:resizeableActivity="true" — can be resized by using a mouse and
dragging the window edges, as with a traditional desktop operating system.
All windows, resizeable or not, can be minimized, putting them in an application dock at the bottom of the DeX screen.
The preview of this section is in an invisible, microscopic font.
The preview of this section was fed to a gremlin, after midnight.