0% found this document useful (0 votes)
14 views22 pages

Mobile Dev - Chapter 7

Uploaded by

hungbui.441
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views22 pages

Mobile Dev - Chapter 7

Uploaded by

hungbui.441
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

CO3043 - MOBILE APPLICATION DEVELOPMENT

CHAPTER 07

MOBILE DEVICE
SENSORS
HOANG LE HAI THANH
High Performance Computing Laboratory, HCMUT - VNUHCM
TABLE OF CONTENTS

01
Introduction to Mobile Device sensors

02
Mobile Device sensors characteristics

03
Common Mobile Device sensors

04
Develop Mobile App with device sensors
01.
INTRODUCTION TO
MOBILE DEVICE
SENSORS
SENSORS
A sensor is a tiny device or module that analyzes its
surroundings and reports the quantitative measure to
the controlling program.

Smartphones today come with a wealth of sensors to


facilitate a better user experience, and provide apps with
enhanced information about the world around the user.
EVOLUTION OF SMARTPHONE SENSORS
EVOLUTION OF SMARTPHONE SENSORS
02.
MOBILE DEVICE
SENSORS
CHARACTERISTICS
ARE SENSORS ALWAYS
CORRECT?
Sensors are characterized depending on the value of
many parameters, and their manufacturers.

We must understand the underlying sensor to get the


right thing we want.

"Numbers don't lie, people do"


RANGE ACCURACY
It is the minimum and maximum value of a physical It is defined as the difference between the measured
variable that the sensor can sense or measure. value and the true value.

SPAN PRECISION
It is the difference between the maximum and It is defined as the closeness among a set of
minimum values of input. values

UNIT
Unit of measurement
SENSITIVITY LINEARITY
It calculates the sensor's output change concerning Linearity is the maximum deviation between the
a unit change in the input (the measured quantity). measured values of a sensor from ideal curve.

RESOLUTION
The slightest change in the input that the sensor can
detect and reliably point out is called resolution.
TYPE
Physical sensors relay data from the source they
present, while composite sensors generate data
from other sensors

REPORTING MODE SAMPLING PERIOD


Sensors can generate events in different ways It is the time difference between two consecutive
called reporting modes (Continues, On-change, data collection (frequency)
One-shot,...)

POWER CALIBRATION
CONSUMPTION Sensor calibration makes that instrument
function as accurately, or error-free, as
It is the energy consumption of the sensor possible
when being used or sleep
03.
COMMON
MOBILE DEVICE
SENSORS
SENSOR CATEGORY (ANDROID)

Motion Sensors Position Sensors Environmental Sensors


These sensors measure acceleration These sensors measure the physical These sensors measure various
forces and rotational forces along position of a device. This category environmental parameters, such as
three axes. This category includes includes orientation sensors and ambient air temperature and
accelerometers, gravity sensors, magnetometers. pressure, illumination, and humidity.
gyroscopes, and rotational vector This category includes barometers,
sensors. photometers, and thermometers.
MOTION SENSORS
Motion sensors are useful for monitoring device movement, such as tilt, shake, rotation, or swing. The movement is usually a
reflection of direct user input, but it can also be a reflection of the physical environment in which the device is sitting

Sensor Type Description Common Uses

Measures the acceleration force in m/s2 that is applied to a device


TYPE_ACCELEROMETER Hardware on all three physical axes (x, y, and z), including the force of Motion detection (shake, tilt, etc.).
gravity.

Measures the force of gravity in m/s2 that is applied to a device on


TYPE_GRAVITY Software or Hardware Motion detection (shake, tilt, etc.).
all three physical axes (x, y, z).

Measures a device's rate of rotation in rad/s around each of the


TYPE_GYROSCOPE Hardware Rotation detection (spin, turn, etc.).
three physical axes (x, y, and z).

Measures the acceleration force in m/s2 that is applied to a device


TYPE_LINEAR_ACCELERATION Software or Hardware on all three physical axes (x, y, and z), excluding the force of Monitoring acceleration along a single axis.
gravity.

Measures the orientation of a device by providing the three


TYPE_ROTATION_VECTOR Software or Hardware Motion detection and rotation detection.
elements of the device's rotation vector.
POSITION SENSORS
Position sensors are useful for determining a device's physical position in the world's frame of reference.

Sensor Type Description Common Uses

Measures the ambient geomagnetic field for all three physical axes (x, y, z)
TYPE_MAGNETIC_FIELD Hardware Creating a compass.
in μT.

Measures degrees of rotation that a device makes around all three physical
axes (x, y, z). As of API level 3 you can obtain the inclination matrix and
TYPE_ORIENTATION Software rotation matrix for a device by using the gravity sensor and the Determining device position.
geomagnetic field sensor in conjunction with
the getRotationMatrix() method.

Measures the proximity of an object in cm relative to the view screen of a


TYPE_PROXIMITY Hardware device. This sensor is typically used to determine whether a handset is Phone position during a call.
being held up to a person's ear.
ENVIRONMENT SENSORS
Environment sensors let you monitor various environmental properties.

Sensor Type Description Common Uses

TYPE_AMBIENT_TEMPERATURE Hardware Measures the ambient room temperature in degrees Celsius (°C). Monitoring air temperatures.

TYPE_LIGHT Hardware Measures the ambient light level (illumination) in lx. Controlling screen brightness.

TYPE_PRESSURE Hardware Measures the ambient air pressure in hPa or mbar. Monitoring air pressure changes.

Monitoring dewpoint, absolute, and relative


TYPE_RELATIVE_HUMIDITY Hardware Measures the relative ambient humidity in percent (%).
humidity.

Measures the temperature of the device in degrees Celsius (°C). This


TYPE_TEMPERATURE Hardware sensor implementation varies across devices and this sensor was replaced Monitoring temperatures.
with the TYPE_AMBIENT_TEMPERATURE sensor
SPECIAL DEVICES
Camera
The camera contains an image
sensor or imager that detects and
conveys information used to make
an image

GNSS
GNSS stands for Global Navigation
Satellite System and is the standard
generic term for satellite navigation
systems. This term includes e.g. the
GPS, GLONASS, Galileo, Beidou,
and other regional systems
SPECIAL DEVICES
Biometric Sensors
A Biometric sensor is an
identification and authentication
device, based on a physical attribute
such as fingerprints, facial images,
iris, and voice recognition.

System Sensors

Internal sensors for monitoring


CPU, GPU, battery, and other
components
04.
DEVELOP MOBILE APP
WITH DEVICE
SENSORS
BEFORE/AFTER USING SENSORS

Determine which sensors are available on a device.

Determine an individual sensor's capabilities, such as its maximum range,


manufacturer, power requirements, and resolution.

Acquire raw sensor data and define the minimum rate at which you
acquire sensor data.

Register and unregister sensor event listeners that monitor sensor


changes.
WHILE USING SENSORS
Be sure you choose a delivery rate that is suitable for your application or
use case. Sensors can provide data at very high rates. Allowing the
system to send extra data that you don't need wastes system resources
and uses battery power.

Only gather sensor data in the foreground. Apps running in the


background have a restriction that can not access sensor events.

Avoid using deprecated methods or sensor types. Several methods and


constants have been deprecated and might return unexpected
behaviors.

Try to test as many different kinds of mobile devices as possible.


Thank you
[email protected]

You might also like