public class Compass
extends java.lang.Object
implements android.hardware.SensorEventListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
Compass.CompassListener
An interface which defines a listener for compass changes.
|
| Constructor and Description |
|---|
Compass(android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
void |
onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy) |
void |
onSensorChanged(android.hardware.SensorEvent event) |
void |
setAzimuthOffset(int offset)
Used to alter the heading users should face.
|
void |
setListener(Compass.CompassListener l)
Sets the compass listener.
|
void |
start()
Starts the sensor listener.
|
void |
stop()
Stops the sensor listener.
|
public void start()
public void stop()
public void onSensorChanged(android.hardware.SensorEvent event)
onSensorChanged in interface android.hardware.SensorEventListenerpublic void setAzimuthOffset(int offset)
offset - heading the user should face in degrees.public void setListener(Compass.CompassListener l)
l - The compass listener.public void onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy)
onAccuracyChanged in interface android.hardware.SensorEventListener