Android : Get min and max values for getOrientation on accelerometer?

on Monday, October 13, 2014


I am currently working with the accelerometer on Android, and have run into an interesting situation. I need to find out the maximum values for the following, WITHOUT requiring the end user to flop their phone around in some elaborate calibration routine. The values I am looking for specifically are...



@Override
public void onSensorChanged(SensorEvent event) {

SensorManager.getOrientation(outR, xyz);

float X, Y, XMax, YMax;

X = xyz[1];
Y = xyz[2];

XMax = ???;
YMax = ???;
}


I've poked around online, but have not had much luck determining what the values would be (it appears it changes from phone to phone), nor seen anyone mention a way to pull that value from somewhere.


Does anyone know how I might determine the maximum/minimum values of xyz[1] and xyz[2]?


0 comments:

Post a Comment