Android environment sensor and android Sensor
Environment Sensor
The Android platform provides four sensors for detecting different external environments. We can use these sensors to detect the surroundings. For example, it can de
This article describes how to obtain a list of sensors supported by your Android device.Currently, Android 4.4 (API level 19) supports the following sensors:Type_accelerometer Accelerometer, Unit m/s2, measurement of the accelerometer type values (sensors type) applied to the device x, Y, Z axes: 1 (0x00000001) Type_ambient_ Temperature temperature sensor, Unit i
Android Basics Getting Started Tutorial--10.11 sensor Special (2)--direction sensortags (space delimited): Android Basics Getting Started TutorialIntroduction to this section:
In the previous section we learned about some of the basic concepts of sensors, and learned about the use of sensor routines,The
In general, getting the location information of the phone in the Android system has the Type_orientation constant in the API, which can be obtained as the accelerometer sensor Sm.getdefaultsensor (sensor.type_ ORIENTATION); However, we do so in the latest version of the SDK will see this sentence: "Type_orientation this constant is deprecated. Use Sensormanager.g
, there are many other types of sensors are used in mobile phones, such as the reluctance sensor is the most important sensor. Although the mobile phone can be used to determine the direction of the GPS, but in the GPS signal is not good or no GPS signal, the GPS on the form of a fictitious. At this point through the reluctance
sensors to work together, with a more accurate feature. The second method is very simple, just like the previous article to get the acceleration, directly to the three axes of data.
Well, from the difficult introduction, because after all, the first method will be a choice for Android in the future, the second do not know when it will become history.
The direction that Android gives us is a float array w
Sensor overviewSensors are one of the important symbols of the second generation of smartphones. Many phones and tablets are now built-in with sensors (except TV). The Android SDK supports a number of more than 10 sensors, but the phone only supports a subset. such as the direction sensor (electronic compass) and the g
The phone sensor detects all the sensors available on the Android phone and graphically shows how they work. Cell phone sensors can also identify which sensors are supported by the phone's hardware and provide a sensing tool that plays an important role in our daily lives. T
;
Interpretation of sensor event values in Android devices
The acceleration sensor, also known as G-sensor, returns the acceleration values of the x, y, and z axes.
This value contains the influence of gravity, measured in m/s ^ 2.
Place the mobile phone on the desktop. The
The latest version of the SDK adds the phrase "type_orientation this constant is deprecated. Use Sensormanager.getorientation () instead. This means that the method has been canceled, and the developer uses sensormanager.getorientation () to get the original data.In fact, the Android get direction is obtained by the magnetic field sensor and the accelerometer sensor
)
Proximity sensor)
Light sensor)
Pressure sensor)
Temperature sensor)
Gravity sensor (introduced in Android 2.3)
Linear acceleration sensor (introduced in
Android sensor (details 2)-common Sensors
Direction sensor Orientation (now almost no longer needed, because there is actually no real direction) Magnetic Field Sensor Magnetic Field Temperature sensor Temperature Light pressure sensor
The android accelerometer is of the sensor. type_accelerometer type.
Return the value of the accelerometer through Android. Hardware. sensorevent.
The Unit returned by the accelerometer is the unit of acceleration m/s ^ 2 (meter per second). The values in three directions are
Values [0]: X-axis Acceleration
Values [1]: acceleration in Y-axis direction
Values [
will become larger, the final appearance is a pulse signal, through the number of pulses can calculate the body's pulse number.Previously there were infrared pulse sensors, but it is difficult to adapt to outdoor and other disturbing light intensity scenes. Using the Rohm sensor technology advantage, the BH1790GLC uses a green light wavelength led photodiode that is ideal for pulse detection, while the photosensitive part uses a green light filter an
parameter passed in by the method is a constant representing the sensor type, and values is a float type array. Its length and content change depending on the sensor type.
3. Register sensorlistener
After developing and playing the sensorlistener, the rest of the work is to register and cancel the listener at the appropriate position of the program. Call the registerlistener method of the sensor
Gesture operation can be said to be a smart phone charm, the first two sections to explain the two interesting gestures, put them in the game, greatly enhance the game's playful and interesting. This section will continue to introduce another magical thing about smartphones: sensors.
first, what is the sensor
The so-called sensor is to be able to detect such as
axes.
Well, it is difficult to introduce it, because after all, the first method will be an option for Android in the future, and the second method will become history in the future.
The direction data provided by Android is a float array containing values in three directions.
When your mobile phone is placed horizontally, it is set to static by defa
previous article, you can directly obtain data on three axes.
Well, it is difficult to introduce it, because after all, the first method will be an option for android in the future, and the second method will become history in the future.
The direction data provided by android is a float array containing values in three directions.
When your mobile phone is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.