In: Computer Science
Purpose
Understand the development of Android Apps using the sensors that can provide information about the device’s internal and external environment and hardware features, such as the camera and phone.
Topic for Discussion
Discuss how the sensors and hardware components on mobile devices can be used to augment the app’s functionality and give an example.
Sensors:
Most Android-powered devices have built-in sensors that include motion, orientation, and various environmental contingencies. These sensors are proficient of providing raw data with high precision and accuracy and are useful if you want to monitor three-dimensional device transfer or positioning, or you want to monitor changes in the ambient environment near a device. For example, a game might track readings from a device's gravity sensor to understand complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather application might use a device's temperature sensor and humidity sensor to calculate and report the dewpoint, or a travel application might use the geomagnetic field sensor and accelerometer to describe a compass bearing
The Android platform supports three broad categories of sensors:
These sensors cover acceleration forces and rotational forces along three axes. This category includes accelerometers, gravity sensors, gyroscopes, and rotational vector sensors.
These sensors measure various environmental parameters, such as ambient air temperature and pressure, illumination, and humidity. This category includes barometers, photometers, and thermometers.
These sensors measure the physical position of a device. This category includes orientation sensors and magnetometers.
Sensor | Type | Description | Common Uses |
---|---|---|---|
TYPE_ACCELEROMETER |
Hardware | Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity. | Motion detection (shake, tilt, etc.). |
TYPE_AMBIENT_TEMPERATURE |
Hardware | Measures the ambient room temperature in degrees Celsius (°C). | Monitoring air temperatures. |
Face filters:
Face filters are one of the most familiar cases where AR is used. The success story of face filters began in 2015 when Snapchat launched them in their app. People have gone crazy about them and started to heavily use them.
But how is it actually possible to show e.g. dog’s ears or tongue on a human head? The answer is to face recognition algorithms and some 3D magic. Recognizing human faces is not a trivial feature, but now there are tools that allow developers to create their own face filters, for example, the Firebase ML Kit.
With Firebase it is possible to detect the positions of eyes, mouth, nose, and contours. Such data can then be used to place a 3D mesh with proper graphics over the camera image.