Hi.
I've checked the doc here:
http://developer.android.com/guide/topics/manifest/uses-feature-element.html
and found 2 most relevant features:
1) android.hardware.sensor.accelerometer
2) android.hardware.sensor.compass
Which one do I need to specify in my manifest? Or both?
Yes, I'm sure I'm using the accelerometer. But the Accelerometer and
Magnetic Field values are also used to calculate "Direction" (which
also means I'm using android.hardware.sensor.compass ??)
Here's my code:
@Override
public void onSensorChanged(SensorEvent event) {
int type = event.sensor.getType();
switch (type) {
case Sensor.TYPE_MAGNETIC_FIELD:
mags = event.values.clone();
break;
//I'm using Accelerometer here
case Sensor.TYPE_ACCELEROMETER:
accels = event.values.clone();
break;
}
SensorManager.getRotationMatrix(rotationMat,
I, accels, mags);
SensorManager.getOrientation(rotationMat,
calculatedOrients);
//I also get direction here, So do I need to specify
android.hardware.sensor.compass in <uses-feature> ?
azimuthZ = (float) Math.toDegrees(calculatedOrients[0]);
pitchX = (float) Math.toDegrees(calculatedOrients[1]);
rollY = -(float) Math.toDegrees(calculatedOrients[2]);
}
Thank you in advance!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en