Rajab Davudov - Android Sensors

3,816 views

Published on

Rajab Davudov - Android Sensors

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,816
On SlideShare
0
From Embeds
0
Number of Embeds
776
Actions
Shares
0
Downloads
88
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Rajab Davudov - Android Sensors

  1. 1. Rajab Davudov
  2. 2. IntroductionMost Android devices are powered withbuilt-in sensors of high accuracy.• Motion Sensors• Environmental Sensors• Position Sensors
  3. 3. Motion SensorsThese sensors measure acceleration forcesand rotational forces along three axes.This category includes• accelerometers• gravity sensors• gyroscopes• …
  4. 4. Environmental SensorsThese sensors measure variousenvironmental parameters:• temperature• pressure• illumination• humidity
  5. 5. Position SensorsThese sensors measure the physicalposition of a device. This category includes:• orientation sensors• magnetometers• proximity
  6. 6. Sensor Table Android 4.0 Android 2.3 Android 2.2 Android 1.5Sensor (API Level 14) (API Level 9) (API Level 8) (API Level 3)TYPE_ACCELEROMETER Yes Yes Yes YesTYPE_AMBIENT_TEMPERATURE Yes n/a n/a n/aTYPE_GRAVITY Yes Yes n/a n/aTYPE_GYROSCOPE Yes Yes n/a1 n/a1TYPE_LIGHT Yes Yes Yes YesTYPE_LINEAR_ACCELERATION Yes Yes n/a n/aTYPE_MAGNETIC_FIELD Yes Yes Yes YesTYPE_ORIENTATION Yes2 Yes2 Yes2 YesTYPE_PRESSURE Yes Yes n/a1 n/a1TYPE_PROXIMITY Yes Yes Yes YesTYPE_RELATIVE_HUMIDITY Yes n/a n/a n/aTYPE_ROTATION_VECTOR Yes Yes n/a n/aTYPE_TEMPERATURE Yes2 Yes Yes Yes
  7. 7. android.hardware• Sensor• SensorEvent• SensorListener• SensorManager
  8. 8. SensorManagerSensorManager mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);List<Sensor> deviceSensors =mSensorManager.getSensorList(Sensor.TYPE_ALL);
  9. 9. SensorListeneronAccuracyChanged()new accuracy of the sensor.onSensorChanged()new data from the sensor
  10. 10. SensorListeneronAccuracyChanged()new accuracy of the sensor.onSensorChanged()new data from the sensor
  11. 11. Tips• Unregister sensors listeners• Don’t block onSensorChanged()• Verify sensors before using them• Choose sensor delays carefully
  12. 12. Ready, Steady, Code !!!
  13. 13. Rajab Davudov Senior Developer at Azerfon radjab@gmail.comhttps://market.android.com/developer?pub=RADJABhttp://gplus.to/radjabhttp://www.fb.me/rajab.davudovhttp://www.linkedin.com/in/radjab Market QR Code

×