Android sensors and functions

Source: Internet
Author: User

Android context data needs to be used recently. Context data needs to be obtained from a wide range of Android sensors. Before that, we should first understand the available Android sensors, and what are their functions?

1. an accelerometer senses the current acceleration of a mobile phone. It can be used to change the Instantaneous Acceleration of the mobile phone. In addition, by measuring the acceleration caused by gravity, you can calculate the tilt angle of the device relative to the horizontal plane.

It is the coordinate of the acceleration sensor data. X y z corresponds to values [0] to [2] respectively. X represents the acceleration of the left and right movement, Y represents the acceleration of the front and back movement, and Z represents the acceleration of the vertical direction. for example, if a mobile phone is horizontally placed on the desktop, it moves from the left to the right. Values [0] is a negative value, and values [0] is a positive value.

2. The gravity sensor and the accelerometer use the same coordinate system. The three elements in the values array indicate the gravity of the X, Y, and Z axes respectively.

In fact, Gravity Sensors have long been integrated with mobile phones. Traditional gravity sensors can only recognize horizontal and vertical movements. The existing mobile phone-integrated gravity sensor is equivalent to the acceleration sensor (check the information and there is no clear functional distinction, so I think so ). The function of changing the direction of the screen varies with the location of the mobile phone.

3. gyroscope is defined as a device for measuring the angle and maintaining the direction. The yellow rotor in the middle is a "gyro", and the surrounding three "steel rings" will change as the device changes its posture. In this way, the current status of the device is detected. The definition is different from the acceleration sensor. Let's see what the difference is: the acceleration sensor is used to sense acceleration. For example, acceleration occurs when the mobile phone moves from static to Mobile, if you shake your cell phone, acceleration will occur. In addition, when mobile phone tilt is used, the gravity difference on the acceleration-sensitive axis is derived from the so-called gravity sensing function, which can roughly sense the tilt angle. The gyroscope is used to fix one direction, just like a rotating gyro placed on a plane, no matter how inclined the plane is, the center axis of the gyro will always remain unchanged. When a gyroscope sensor is installed on a mobile phone, the orientation will be fixed out of thin air. No matter how mobile phones move, the orientation will remain unchanged. For example, in some mobile phone shooting games, the shooting accuracy will remain unchanged, then you can aim for the target through the mobile phone location, or implement the Anti-shake function of the mobile phone.

4. GPS (global positioning system) is very familiar to everyone. It is often used for positioning and navigation. In the android SDK, there is a location object, which includes the longitude and latitude of the current location. You can even use location. getspeed () to get the running speed of the mobile phone user. Of course, location acquisition is not only based on GPS, but can be located through the base station or WiFi.

5. Currently, many mobile phones have implemented the Electronic Compass function. To realize the Electronic Compass function, a three-axis magnetic sensor and a three-axis acceleration sensor are required. With the maturity of the micro-mechanical process, method semiconductor has released a two-in-one sensor module lsm303dlh, which integrates the three-axis magnetic sensor and three-axis accelerator into one package, this allows you to design low-cost and high-performance electronic compass in a short time. Therefore, mobile phones support electronic compass, which is equivalent to magnetic sensors. The biggest use of electronic compass is to use it as a compass.

There are also some other sensors: the pressure sensor is used to determine the current height of the mobile phone. The light sensor can adjust the screen brightness according to the Light Conditions of the mobile phone, distance sensors are often used to identify the distance between a face and a mobile phone to enable switching between bright and black screens during a call.

The above is commonly used mobile phone sensors and its functions, does not involve programming implementation, want to understand programming implementation details recommended blog http://blog.csdn.net/sfshine/article/details/7439664

Reference:

Http://cnetwei.iteye.com/blog/781602

Http://blog.csdn.net/octobershiner/article/details/6639040

Http://baike.baidu.com/view/3560846.htm

Http://wenku.baidu.com/view/1a9ab9d6b9f3f90f76c61b98.html

Http://baike.baidu.com/view/4812184.htm

Http://zhidao.baidu.com/question/409401962.html&__bd_tkn__=72a84d6c7c29da245659b872a9bc64fe8b1d89aa8078338d51fed8133ea5c69d362ad36bb4bcda3b39bb3949f6bbe47087ac3af56e60b1f4e7eb60157c5cf4369d66a0fe5c0f03de0125270ed534ce0a487f9303082abefcd139440e7229352ecf620b3a4eb6afdb9d06feaccbdc8c0bcf3024f64daa

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.