TAILIEUCHUNG - Bài giảng Lập trình cho thiết bị di động: Chương 7 - Trần Duy Thanh

Bài giảng Lập trình cho thiết bị di động: Chương 7 trình bày các nội dung sau: Sensors, Working with Sensor, Monitoring the Battery,.! | 1 1. Sensors 2. Monitoring the Battery 1 2 1. Sensors The emulator does not provide any sensor data. All sensor testing must be done on a physical device. Alternatively, also provides a handy Sensor Simulator: This tool simulates accelerometer, compass, and temperature sensors, and it transmits data to the emulator. Android devices have a variety of sensors : 2 3 1. Sensors TYPE_ACCELEROMETER: Measures acceleration in three directions; values are in SI units (m/s2). TYPE_GYROSCOPE: Measures angular orientation in three directions; values are angles in degrees. TYPE_LIGHT: Measures ambient light; values are in SI lux units. TYPE_MAGNETIC_FIELD: Measures magnetism in three directions; the compass values are in micro-Tesla (uT). TYPE_PRESSURE: Measures barometric pressure. TYPE_PROXIMITY: Measures the distance to an object; values are in centimeters, or “near” versus “far.” TYPE_RELATIVE_HUMIDITY: Measures the relative humidity. TYPE_AMBIENT_TEMPERATURE: Measures temperature. 3 4 1. Sensors Here are the major classes related to sensor. Class Comment Sensor Class representing a sensor. Use getSensorList(int) to get the list of available Sensors. SensorEvent This class represents a Sensor event and holds informations such as the sensor's type, the time-stamp, accuracy and of course the sensor's data. SensorEventListener An interface: Used for receiving notifications from the SensorManager when sensor values have changed. SensorManager SensorManager lets you access the device's sensors. Get an instance of this class by calling () with the argument SENSOR_SERVICE. 4 5 1. Sensors Working with Sensor To get a Sensor, you need to use SensorManager. 5 6 1. Sensors Working with Sensor Register EventListener to it. 6 7 1. Sensors Working with Sensor UnRegister EventListener. Register in the onResume method and Unregister in the onPause method 7 8 1. Sensors .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.