If you want your app to respond to the user shaking the phone, then you need to follow these instructions:
{
await base.OnInitializing();
// ....
Device.Accelerometer.DeviceShaken.Handle(OnDeviceShaken);
}
Add the event handler:
{
return Alert.Show("TADA! You device was shaken!");
}
Remove the handler when your page or module is disposed:
{
Device.Accelerometer.DeviceShaken.RemoveHandler(OnDeviceShaken);
base.Dispose();
}
To test the shake functionality on Windows (dev time) launch the inspector by pressing the Ctrl + Click on any element.
The on the top bar, click on the Shake icon.