Android Orientation Sensor (Direction Sensor) details and applications, androidorientation
I. Preface
This blog is my first article on "Android advanced". It has been around for more than four months since I started Android, and I have some experiences, I can also do something on my own. Thanks to the android development tips of our company and the omnipotent
The Android platform provides several sensors that can monitor the movement of devices. Two of them are hardware-based (accelerometer and gyroscope). Three sensors can be hardware-based, it can also be software-based (Gravity Sensors, linear acceleration sensors, and rotating vector sensors ). For example, some software sensor-based devices extract their data from the accelerometer and the magnetic sensor,
This article translated from: http://developer.android.com/guide/topics/sensors/sensors_motion.html
The Android platform provides several sensors that can monitor the movement of devices. Two of them are hardware-based (accelerometer and gyroscope). Three sensors can be hardware-based, it can also be software-based (Gravity Sensors, linear acceleration sensors, and rotating vector sensors ). For example, some software sensor-based devices extract thei
Android motion sensor
Android motion sensor
The Android platform supports some sensors used to monitor device movements (five such sensors ). Two of them are pure hardware sensors. The other three (Gravity Sensors, linear acceleration sensors, and Rotation Vector Sensors) may be hardware sensors or software sensors. Fo
Sensors on the Android platform include the accelerometer, orientation, magnetic field, and light ).
The development of sensor applications on the Android platform is implemented through the listener mechanism. The main steps to develop applications for one or more sensors are as follows:
1. Create a sensormanager object
2. Implement the sensorlistener Int
First of all, the gyroscope sensor needs to be debugged in the real machine environment, the PC end has no effect.1. Get the SensorThe devicemotion event is monitored on the window, and the accelerationincludinggravity (built-in gravitational acceleration sensor) object is obtained through the event object. The code is as follows:function (e) { var motion
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.