Android Devices
Hardware
Differences on Android Devices
The hardware available on
each Android device varies, as seen in Table 1.1. In general, most of the
differences are transparent to the developer and not covered further here. However,
a few hardware differences are important to understand to assist in writing device-independent
code. Screens, user input methods, and sensors are discussed here.
Screens
Two technologies used for
displays are liquid crystal displays (LCD) and light-emitting diodes (LED).The
two specific choices in Android phones are thin-film transistor (TFT) LCDs and
active-matrix organic LED displays (AMOLED).A benefit of TFT displays is a longer
lifetime. A benefit of AMOLED displays is no need for backlighting and
therefore deeper blacks and lower power.
Overall,Android devices
are categorized into small, normal, and large screens and low-, medium-, and
high pixel density. Note that the actual pixel density might vary but will be chosen
as one of these.A summary of currently available device screens is shown in
Table.
Summary
of Device Screens Supported by Android
Screen
Type
|
Low-Density
(~120ppi), ldpi
|
Medium-Density
(~160ppi), mdpi
|
High-Density
(~240ppi), hdpi
|
Small
screen
|
QVGA (240x320), 2.6-inch
to 3.0-inch diagonal
|
||
Normal
screen
|
WQVGA (240x400),
3.2-inch to 3.5-inch
diagonal
FWQVGA (240x432), 3.5-
inch to 3.8-inch diagonal
|
HVGA (320x480), 3.0-
inch to 3.5-inch
diagonal
|
WVGA (480x800),
3.3-inch to 4.0-inch
diagonal
FWVGA (480x854),
3.5-inch to 4.0-inch
diagonal
|
Large
screen
|
WVGA (480x800),
4.8-inch to 5.5-inch
diagonal
FWVGA (480x854),
5.0-inch to 5.8-inch
Diagonal
|
User
Input Methods
Touchscreens enable users
to interact with the visual display.There are three types of touchscreen
technology:
- Resistive—Two resistive material layers sit on top of a glass screen.When a finger, stylus, or any object applies pressure, the two layers touch together and the location of the touch can be determined. Resistive touchscreens are cost-effective, but only 75 percent of the light shows through, and until recently, multitouch was not possible.
- Capacitive—A charged material layer is overlaid on a glass screen.When a finger or any conductive object touches the layer, some charge is drawn off, changing the capacitance, which is measured to determine the location of the touch. Capacitive touchscreens allow as much as 90 percent of the light through, although accuracy can be less than resistive.
- Surface Acoustic Wave—This uses a more advanced method that sends and receives ultrasonic waves.When a finger or any object touches the screen, the waves are absorbed.
The waves are measured to
determine the location of the touch. It is the most durable solution, but more
suitable for large-scale screens such as automatic bank tellers.
All Android devices use
either resistive or capacitive touchscreen technology, and with a few early
exceptions, all support multitouch.
In addition, each Android
device needs an alternative method to access the screen.This is through one of
the following methods:
- D-pad (directional pad)—An up-down-right-left type of joystick
- Trackball—A rolling ball acting as a pointing device that is similar to a mouse
- Trackpad—A special rectangular surface acting as a pointing device
Sensors
Smartphones are becoming
sensor hubs in a way, opening a rich experience for users. Other than the
microphone that every phone has, the first additional sensor introduced on
phones was the camera. Different phone cameras have varying capabilities, and
this is an important factor for people in selecting a device.The same type of
diversity is now seen with the additional sensors.
Most smartphones have at
least three basic sensors: a three-axis accelerometer to measure gravity, a
three-axis magnetometer to measure the ambient magnetic field, and a
temperature sensor to measure the ambient temperature. For example, the HTC
Dream (G1) contains the following sensors (which can be displayed using getSensorList()
AK8976A 3-axis Accelerometer
AK8976A 3-axis Magnetic field sensor
AK8976A Orientation sensor
AK8976A Temperature sensor
The AK8976A is a single
package from Asahi Kasei Microsystems (AKM) that combines a piezoresistive
accelerometer, Hall-effect magnetometer, and temperature sensor. All provide
8-bit precision data.The orientation sensor is a virtual sensor that uses the accelerometer
and magnetometer to determine the orientation.
For comparison, the
Motorola Droid contains the following sensors:
LIS331DLH 3-axis Accelerometer
AK8973 3-axis Magnetic field sensor
AK8973 Temperature sensor
SFH7743 Proximity sensor
Orientation sensor type
LM3530 Light sensor
The LIS331DLH is a 12-bit
capacitive accelerometer from ST Microelectronics. It provides much more
accurate data and can sample up to 1kHz.The AK8973 is an AKM package with an
8-bit Hall-effect magnetometer and temperature sensor.
In addition, the Droid
contains two more sensors.The SFH7743 is an Opto Semiconductor’s short-range proximity
detector that turns the screen off when an object (such as the ear) is within
about 40mm distance.The LM3530 is an LED driver with a programmable light
sensor from National Semiconductor that detects ambient light and adjusts the
screen backlight and LED flash appropriately.
One other example of
sensors available on an Android device is the HTC EVO 4G, which has the
following sensors:
BMA150 3-axis Accelerometer
AK8973 3-axis Magnetic field sensor
AK8973 Orientation sensor
CM3602 Proximity sensor
CM3602 Light sensor
The BMA150 is a Bosch
Sensortec 10-bit accelerometer which can sample up to 1.5kHz.The CM3602 is a
Capella Microsystems, Inc., short distance proximity sensor and ambient light
sensor combined into one.
Overall, it is important
to understand each Android model has different underlying hardware.These
differences can lead to varying performance and accuracy of the sensors.
Features
of Android
The detailed features of
Android and how to take advantage of them provide a main theme throughout this
book. On a broader level, some key features of Android are major selling points
and differentiators. It is good to be aware of these strong points of Android and
utilize them as much as possible.
Multiprocess
and App Widgets
The Android OS does not
restrict the processor to a single application at a time.The system manages
priorities of applications and threads within a single application.This has the
benefit that background tasks can be run while a user engages the device in a
foreground process. For example, while a user plays a game, a background process
can check stock prices and trigger an alert as necessary.
App Widgets are mini
applications that can be embedded in other applications (such as the Home
screen).They can process events, such as start a music stream or update the outside
temperature, while other applications are running.
Multiprocessing has the
benefit of a rich user experience. However, care must be taken to avoid
power-hungry applications that drain the battery.These multiprocess .
Touch,
Gestures, and Multitouch
The touchscreen is an
intuitive user interface for a hand-held device. If utilized well, it can
transcend a need for detailed instructions. After a finger touches the screen,
drags and flings are natural ways to interact with graphics. Multitouch
provides a way to track more than one finger down at the same time.This is
often used to zoom or rotate a view.
Some touch events are
available transparently to the developer without the need to implement their
detailed behaviors. Custom gestures can be defined as needed. It is important
to try to maintain a consistent usage of touch events as compared to other applications.These
touch events are discussed further in other Chapter.
Hard
and Soft Keyboards
One feature on a pocket
device that galvanizes users is whether it should have a physical (also called
hard) keyboard or software (also called soft) keyboard.The tactile feedback and
definite placement of keys provided by a hard keyboard tends to make typing
much faster for some, whereas others prefer the sleek design and convenience
offered by a software- only input device.With the large variety of Android
devices available, either type can be found.A side effect for developers is the
need to support both. One downside of a soft keyboard is a portion of the
screen needs to be dedicated to the input.This needs to be considered and
tested for any user interface (UI) layout.