Alibabacloud.com offers a wide variety of articles about compass app without magnetic sensor, easily find your compass app without magnetic sensor information here online.
paramsensor, int paramint) {TODO auto-generated Method Stub}};}First use the superimposed two pictures, one as the pointer, the other as the background four directions LXML file:Android:layout_width= "Match_parent"android:layout_height= "Match_parent" >Android:id= "@+id/compass_img"Android:layout_width= "Wrap_content"android:layout_height= "Wrap_content"Android:layout_centerinparent= "true"android:src= "@drawable/compass"/>Android:id= "@+id/arrow_img
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
Android practice simple tutorial-62nd guns (electronic Sensor exact Compass)
Here we use the sensor provided by the mobile phone to implement a simple small example of the electronic compass. You can learn how to use the SensorManager class, SensorEventListener and its overwriting method.
First, create a layout file:
involves three concepts:Roll: left and right tilt angle, also called Rolling Angle http://baike.baidu.com/view/1769672.htmPitch: front and back tilt, also called the pitch angle http://baike.baidu.com/view/3832041.htmYaw: Left and Right swing, also called yaw angle http://baike.baidu.com/view/1769448.htm
The following code is the source code of/development/samples/compass in android2.3. It demonstrates how to determine the placement posture and orien
data to the actual gravity coordinate. Generally, it can be set to null by default.
The third is an array of 3, indicating that the data obtained from the accelerometer is in onsensorchanged.
The fourth is an array of 3, which indicates the data obtained from the magnetic sensor.In onsensorchanged
Well, the basic logic is like this. The following is an example of a simple test direction, which can monitor the user's direction at all times.
.
The second is a conversion matrix, which converts the magnetic field data to the actual gravity coordinate. Generally, it can be set to null by default.
The third is an array of 3, indicating that the data obtained from the accelerometer is in onSensorChanged.
The fourth is an array of 3, indicating that the data obtained from the magnetic sensor is in onSensor
measurement mode, single measurement I used a bit, not very good, so the following main introduction of continuous measurement. Configuration as a continuous measurement is simple, is the above mode register, address 0x02 As you can see, configuring a continuous measurement mode requires only writing the mode register to 0x00. Configuration to continuous, configured as sequential read mode there is a very important place to remember: read XYZ, must read 6 bytes at a time, that is, all r
I just followed the video to learn the operation examples of sensors in Android, and made a very simple compass application using the direction sensor... Sensor functions are rarely used in work projects, so many of them don't know. Now I want to learn more about it as a step-by-step approach...
First paste the software for final operation
The image material use
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.