How to vibrate a Windows Phone device (XAML)

Applies to Windows Phone only

Windows Phone devices include a vibration controller. Your phone app can vibrate the phone for up to 5 seconds to notify the user of an important event.

Use the vibration feature in moderation. Don't rely on the vibration feature for critical notifications, because the user can disable vibration.

To test a phone app that uses the vibration controller effectively, you have to test it on a physical device. The emulator can't simulate vibration and does not provide any visual feedback that vibration is occurring.

An app that's running in the background can't vibrate the phone. If your code tries to use vibration while the app is running in the background, nothing happens, but no exception is raised. If you want to vibrate the phone while your app is running in the background, you have to implement a toast notification. For more info, see Sending toast notifications.


Step 1: Import the namespace.

using Windows.Phone.Devices.Notification;

Step 2: Get a reference to the vibration controller

VibrationDevice testVibrationDevice = VibrationDevice.GetDefault();

Step 3: Start the vibration

Accepted values for the duration argument are from 0 to 5 seconds; any greater or lesser value raises an ArgumentException error.


Step 4: Optional: Stop the vibration




© 2015 Microsoft