0
votes

What is the difference between shake and vibrate? I need some help on these:

1) How to detect the phone vibration when phone lying on the surface. 2) How to detect the phone vibration when it is hanging.

Your help and code sample much appreciated. Thanks

--- Update

does shake mean movement along x and y ?

and Virbate means movement Up and down vertically?


// Constructor
public MainPage()
{
    InitializeComponent();
    acc.ReadingChanged += new EventHandler(acc_ReadingChanged);
    acc.Start();
}

void acc_ReadingChanged(object sender, AccelerometerReadingEventArgs e)
    {
    Deployment.Current.Dispatcher.BeginInvoke(() => ThreadSafeAccelerometerChanged(e));
    }

void ThreadSafeAccelerometerChanged(AccelerometerReadingEventArgs e)
{
    XText.Text = e.X.ToString("0.000");
    YText.Text = e.Y.ToString("0.000");
    ZText.Text = e.Z.ToString("0.000");
}

1

1 Answers

0
votes

Shake usually involves the use of accelerometer in the phone to detect any shake gesture/event. You may program your application accordingly on the occurrence of shake gesture. Whereas you may use vibration to prompt the user of some kind of output or event that has happened like in a game when you win/lose.

All in all shake is a kind of input gesture and vibration is output gesture.

For accelerometer refer this http://msdn.microsoft.com/en-us/library/ff604984.aspx and for vibration behavior you may start of with this http://blog.xyzzer.me/2012/01/09/vibration-behaviors-for-windows-phone-part-1/

Hope it helps