1. The positive and negative directions of the X, Y, and Z axes of the accelrator:
When the mobile phone screen is placed horizontally up: (x, y, z) = (0, 0,-10) instead of (0, 0, 10)
When the phone is lifted at the top, y decreases and the value is negative.
When the mobile phone is lifted at the bottom: Y increases and is positive
When the right side of the mobile phone is lifted: X decreases and is negative.
When the left side of the mobile phone is lifted: X increases and the value is positive.
2. Change of the Z axis of the accelrator:
Z =-10
When the mobile phone screen is placed vertically, Z = 0
When the mobile phone screen is placed horizontally down, Z = 10
3. When X is changed to + 5, the mobile phone screen changes to vertical.
When x changes to-5, the mobile phone screen changes to horizontal
4. classes related to Android sensors are different in sdk1.1 and sdk1.5.CodeDifferent
5. Android sensor types include: direction, acceleration table, light, magnetic field, closeness, temperature, etc.
ProgramAre:
Direction: sensormanager. sensor_orientation,
Acceleration table: sensormanager. sensor_accelerometer
Light: sensormanager. sensor_light
Magnetic Field: sensormanager. sensor_magnetic_field
Closeness: sensormanager. sensor_proximity
Temperature: sensormanager. sensor_temperature
Sampling Rate: the fastest, game, common, and user interface. When an application requests a specific sampling rate, it only prompts or recommends the android sensor subsystem. The specified sampling rate is not guaranteed.
Fastest: sensormanager. sensor_delay_fastest
Game: sensormanager. sensor_delay_game
Normal: sensormanager. sensor_delay_normal
User Interface: sensormanager. sensor_delay_ui
Accuracy: High, low, medium, and unreliable.
6. Definitions of three coordinates of orientation sensor:
Values [0]: azimuth (horizontal rotation angle), which is the orientation of the head of the mobile phone, 0 = North, 90 = east, 180 = South, 270 = West (but it seems not accurate)
Values [1]: Vertical Rotation Angle, 0 = face flat,-90 = vertical up,-180/180 = face flat, 90 = vertical down
Values [2]: rotate to the rotation angle, 0 = forward, 90 = backward to right,-90 = backward to left
7. Automatic Detection of mobile phone direction
To make the mobile phone rotate automatically, you only need to change Orientaion to sensor in androidmanifest. XML, but to make the activity detect a direction change, you need to capture the display of the activity:
1. if (getwindowmanager (). getdefadisplay display (). getorientation () = 0) {
2. // do some portrait
[...]