Accelerometer _accelerometer;
int _shakeCount = ;
public MainPage()
{
this.InitializeComponent();
_accelerometer=Accelerometer.GetDefault();
if (_accelerometer != null)
_accelerometer.Shaken += new TypedEventHandler<Accelerometer, AccelerometerShakenEventArgs>(Shaken);
} async private void Shaken(object sender, AccelerometerShakenEventArgs e)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
_shakeCount++;
}); if (_shakeCount >= )
{
//method call
_shakeCount = ;
}
}
Don't know if it works?