I have an app where I want to access the magnotometer. I get results out of my application, but compared with orientation results from the compass app of g1 I get completely different results with my app than the compass app. e.g.: my app sais 250° and the compass app 90°! That just can't be, here is my code. Is there any difference to become better results?
public class MySensorListener implements SensorListener{
int orientation;
public MySensorListener(){
orientation = 0;
}
public void onAccuracyChanged(int sensor, int accuracy) {
// TODO Auto-generated method stub
}
public void onSensorChanged(int sensor, float[] values) {
orientation = (int)values[0];
}
}
I acess the Sensormanager like this:
private MySensorListener doCompass(){
MySensorListener cl;
SensorManager cm;
compassListener = new MySensorListener();
cm = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
cm.registerListener(
cl,
SensorManager.SENSOR_ORIENTATION,
SensorManager.SENSOR_DELAY_UI); //updateRate
return cl;
}
Can anyone help, pleeease?! :)
Thank you