Thanks for your response.
Is there any documentation on the web that contains some of the
parameters(already tuned to some extent) that I can try with. For instance I
found couple of examples talking about shake and there is a mention of:
(accelationSquareRoot >= 2) means shake detected,
This is the complete code for this:

public void onSensorChanged(SensorEvent event) {
// TODO
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
 float[] values = event.values;
// Movement
float x = values[0];
 float y = values[1];
float z = values[2];

float accelationSquareRoot = (x * x + y * y + z * z)
 / (SensorManager.GRAVITY_EARTH * SensorManager.GRAVITY_EARTH);
long actualTime = System.currentTimeMillis();
 if (accelationSquareRoot >= 2) //
{
if (actualTime - lastUpdate < 200) {
 return;
}
lastUpdate = actualTime;
 // Shake Detected
// TODO: do something
 }

}
}

Thanks in advance.

Regards,
KK

On Thu, Sep 29, 2011 at 10:46 PM, ColorTheorist <
colortheorydevelo...@gmail.com> wrote:

> You'll have to use the sensormanager class and use thresholds as you
> have mentioned at the lowest level by subscribing to the
> accelerometer. From there you should be able to do what you want. If
> there are nice libraries that will do mathematical calculations that
> often accompany these readings I do not know of one.  Similar readings
> for orientation for tilt can be done with the sensormanager.
>
> On Sep 29, 12:08 am, KK <dioxide.softw...@gmail.com> wrote:
> > Hi All,
> > Can someone explain about how to capture a particular movement, meaning
> > there must be some mechanism to capture the changes in X,Y and Z
> > co-ordinates and other things calculate the corresponding acceleration
> etc
> > and then set the threshold for your required shake/move. If I want to try
> a
> > new shake, how to do I set the threshold value, what is the usual
> process?
> >
> > I was wondering, is there any way we can use enable SensorSimulator and
> let
> > it capture all the sensor parameters during shake/move and then pick
> those
> > recorded values and set your threshold. I think this must
> > be repetitive process, if someone wants to tune the threshold value.
> Would
> > appreciate if someone can throw some light on this.
> >
> > Thanks,
> > KK
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to