I'm doing this application that works like a pedometer counting steps, but I want it to show orientation for each step.
What i'm doing is registering two event listeners and than for each onsensorchanged
event I'm picking up the values of the sensor.TYPE_ORIENTATION
to get the azimuth angle, and of the sensor.TYPE_ACCELEROMETER
, where I see if a step is given or not.
At this time I'm getting the values correctly but I want to peak only the azimuth angla when the step count is done!How do I do this ?
I'm supposing that it will be done inside the OnSensorChanged
method, but I'm not getting an idea on how to just call Orientation sensor, when Accelerometer Sensor is activated and a step is count..
Looking inside the code it will be something like this:
after registering the two listeners, ACCELEROMETER
and ORIENTATION
OnSensorChanged(SensorEvent event)
{
if((event.sensor.getType()==Sensor.TYPE_ACCELEROMETER))
accValues=event.values;
// NOW get the orientation azimuth value at this time..
orientationValues=event.values;
}
Hope that someone can clarify me on this..