(MRWD) Sensors Lesson

Sensors

Sensors are used to gather real world data around us and turn that into useful information. Mobile devices have sensors that measure motion, orientation, and various environmental conditions. For instance, games might track a user's gestures and motions, such as tilt, shake, rotation or swing. Other apps use sensory data such as temperature and steps taken. Travel apps might use geomagnetic field sensor and accelerometer to report compass directions or locations.

sensor components UI:
Sensors
AccelerometerSensor
BarcodeScanner
Clock
GyroscopeSensor
LocationSensor
NearField
OrientationSensor
Pedometer
Proximity SensorMost phone have the following sensors:

  • Accelerometer
  • Gyroscope
  • Digital Compass
  • Ambient Light Sensor
  • Proximity Sensor
  • Temperature Sensor
  • Sound
  • Pedometer
  • Fingerprint Sensors
  • Heart Rate Monitors
  • Barometer
  • IR Blaster Sensor

 

Explore each section in the tabs below to learn more.

Accelerometer Sensor

 

This component can determine if the phone is shaking and if it's being held upright or upside-down. This capability is very useful when you want the screen to re-orient in response to how the phone is being held, or if you want the app to react to shaking.

 

 

 

Some of the sensors do not work with the emulator. You need to export the app to an Android device to properly use the sensor features.

 

[CC BY 4.0] UNLESS OTHERWISE NOTED | IMAGES: LICENSED AND USED ACCORDING TO TERMS OF SUBSCRIPTION