Advanced Article-Android system: 5. Android Phone position sensor

Source: Internet
Author: User

The Android platform provides two sensor terms to determine the location of the device, these two sensors are magnetic field sensors and directional sensors. The Android platform also provides sensors (proximity sensors) that measure the distance from the front of a device to a nearby object. magnetic field sensors and proximity sensors are based on hardware sensors.

Purpose: It is possible to combine magnetic field sensors and accelerometers to measure the position of the device relative to the geomagnetic North Pole, and to use the direction sensor to determine the position of the current device relative to its own reference frame.

Both the magnetic field sensor and the direction sensor return three values, and the proximity sensor returns a value.

Meaning of the direction three values:

Event.valuss[0]: The angle of rotation around the z axis. If the y-axis is on the north, the value is 0. If you point east, the value is 90, and if the y-axis points to the West, the value is 270.

EVENT.VALUSS[1]: The degree of rotation around the x-axis. If the z-axis is positive toward the y-axis positive direction, the value is positive and vice versa. The value varies between 180 and 180.

EVENT.VALUSS[2]: The degree of rotation around the y-axis. When the positive direction of the x-axis is positive from the z-axis, the value is positive and the inverse is negative. The value varies between 180 and 180.

Use the same as the accelerometer sensor.

Advanced Article-Android system: 5. Android Phone position sensor

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.