Bài giảng Lập trình cho thiết bị di động: Chương 7 - ĐH Công nghệ Đồng Nai
Số trang: 35
Loại file: pptx
Dung lượng: 2.38 MB
Lượt xem: 13
Lượt tải: 0
Xem trước 4 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Bài giảng Lập trình cho thiết bị di động: Chương 7 - Thao tác với thiết bị cảm ứng có nội dung trình bày về Sensors và Monitoring the Battery. Tham khảo nội dung bài giảng để hiểu rõ hơn về các nội dung trên.
Nội dung trích xuất từ tài liệu:
Bài giảng Lập trình cho thiết bị di động: Chương 7 - ĐH Công nghệ Đồng Nai DONG NAI UNIVERSITY OF TECHNOLOGY 1. Sensors2. Monitoring the Battery 1 DONG NAI UNIVERSITY OF TECHNOLOGY1. SensorsThe emulator does not provide any sensor data. All sensortesting must be done on a physical device. Alternatively,OpenIntents.org also provides a handy Sensor Simulator:http://code.google.com/p/openintents/wiki/SensorSimulatorThis tool simulates accelerometer, compass, andtemperature sensors, and it transmits data to the emulator.Android devices have a variety of sensors : 2 DONG NAI UNIVERSITY OF TECHNOLOGY 1. SensorsTYPE_ACCELEROMETER: Measures acceleration in threedirections; values are in SI units (m/s2).TYPE_GYROSCOPE: Measures angular orientation in threedirections; values are angles in degrees.TYPE_LIGHT: Measures ambient light; values are in SI luxunits.TYPE_MAGNETIC_FIELD: Measures magnetism in threedirections; 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 DONG NAI UNIVERSITY OF TECHNOLOGY 1. Sensors Ø Here are the major classes related to sensor. Class CommentSensor Class representing a sensor. Use getSensorList(int) to get the list of available Sensors.SensorEve This class represents a Sensor event andnt holds informations such as the sensors type, the time-stamp, accuracy and of course the sensors data.SensorEventListe An interface: Used for receiving notificationsner from the SensorManager when sensor values have changed.SensorManag SensorManager lets you access the deviceser sensors. Get an instance of this class by calling Context.getSystemService() with the 4 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Working with Sensorü To get a Sensor, you need to use SensorManager. 5 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Working with Sensorü Register EventListener to it. 6 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Working with Sensorü UnRegister EventListener.Register in the onResume method andUnregister in the onPause method 7 DONG NAI UNIVERSITY OF TECHNOLOGY1. SensorsØ SensorManager.SENSOR_DELAY Frequence CommentSENSOR_DELAY_FASTE get sensor data as fast asST possibleSENSOR_DELAY_NORM rate (default) suitable forAL screen orientation changesSENSOR_DELAY_GAME rate suitable for gamesSENSOR_DELAY_UI rate suitable for the user interface 8 DONG NAI UNIVERSITY OF TECHNOLOGY1. SensorsØ Receive SensorEvent Normally, onSensorChanged is the method in which we need to put your sensor handle logic. 9 DONG NAI UNIVERSITY OF TECHNOLOGY 1. Sensors Ø SensorEvent Type Name Comment public int accuracy The accuracy of this event. public Sensor sensor The sensor that generated this event. public long timestamp The time in nanosecond at which the event happenedpublic final float[] values The length and contents of the values array depends on which sensor type is being monitored. 10 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Sensor.TYPE_TEMPERATU RE 11 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Sensor.TYPE_TEMPERATU ...
Nội dung trích xuất từ tài liệu:
Bài giảng Lập trình cho thiết bị di động: Chương 7 - ĐH Công nghệ Đồng Nai DONG NAI UNIVERSITY OF TECHNOLOGY 1. Sensors2. Monitoring the Battery 1 DONG NAI UNIVERSITY OF TECHNOLOGY1. SensorsThe emulator does not provide any sensor data. All sensortesting must be done on a physical device. Alternatively,OpenIntents.org also provides a handy Sensor Simulator:http://code.google.com/p/openintents/wiki/SensorSimulatorThis tool simulates accelerometer, compass, andtemperature sensors, and it transmits data to the emulator.Android devices have a variety of sensors : 2 DONG NAI UNIVERSITY OF TECHNOLOGY 1. SensorsTYPE_ACCELEROMETER: Measures acceleration in threedirections; values are in SI units (m/s2).TYPE_GYROSCOPE: Measures angular orientation in threedirections; values are angles in degrees.TYPE_LIGHT: Measures ambient light; values are in SI luxunits.TYPE_MAGNETIC_FIELD: Measures magnetism in threedirections; 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 DONG NAI UNIVERSITY OF TECHNOLOGY 1. Sensors Ø Here are the major classes related to sensor. Class CommentSensor Class representing a sensor. Use getSensorList(int) to get the list of available Sensors.SensorEve This class represents a Sensor event andnt holds informations such as the sensors type, the time-stamp, accuracy and of course the sensors data.SensorEventListe An interface: Used for receiving notificationsner from the SensorManager when sensor values have changed.SensorManag SensorManager lets you access the deviceser sensors. Get an instance of this class by calling Context.getSystemService() with the 4 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Working with Sensorü To get a Sensor, you need to use SensorManager. 5 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Working with Sensorü Register EventListener to it. 6 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Working with Sensorü UnRegister EventListener.Register in the onResume method andUnregister in the onPause method 7 DONG NAI UNIVERSITY OF TECHNOLOGY1. SensorsØ SensorManager.SENSOR_DELAY Frequence CommentSENSOR_DELAY_FASTE get sensor data as fast asST possibleSENSOR_DELAY_NORM rate (default) suitable forAL screen orientation changesSENSOR_DELAY_GAME rate suitable for gamesSENSOR_DELAY_UI rate suitable for the user interface 8 DONG NAI UNIVERSITY OF TECHNOLOGY1. SensorsØ Receive SensorEvent Normally, onSensorChanged is the method in which we need to put your sensor handle logic. 9 DONG NAI UNIVERSITY OF TECHNOLOGY 1. Sensors Ø SensorEvent Type Name Comment public int accuracy The accuracy of this event. public Sensor sensor The sensor that generated this event. public long timestamp The time in nanosecond at which the event happenedpublic final float[] values The length and contents of the values array depends on which sensor type is being monitored. 10 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Sensor.TYPE_TEMPERATU RE 11 DONG NAI UNIVERSITY OF TECHNOLOGY1. Sensors Ø Sensor.TYPE_TEMPERATU ...
Tìm kiếm theo từ khóa liên quan:
Thiết bị di động Kỹ thuật lập trình Điện thoại di động Lập trình điện thoại Giao diện người dùng Xử lý tập tinTài liệu có liên quan:
-
Bài giảng Phân tích thiết kế hệ thống thông tin: Chương 3 - Hệ điều hành Windowns XP
39 trang 385 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 309 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 248 0 0 -
43 trang 223 0 0
-
Giới thiệu môn học Ngôn ngữ lập trình C++
5 trang 222 0 0 -
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 188 0 0 -
72 trang 180 0 0
-
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 159 0 0 -
Đồ án tốt nghiệp ngành Công nghệ thông tin: Lập trình game trên thiết bị di động
56 trang 157 0 0 -
33 trang 147 0 0