VibrationDevice VibrationDevice VibrationDevice VibrationDevice VibrationDevice Class


Vibrates the phone.

public : sealed class VibrationDevice : IVibrationDevice
struct winrt::Windows::Phone::Devices::Notification::VibrationDevice : IVibrationDevice
public sealed class VibrationDevice : IVibrationDevice
Public NotInheritable Class VibrationDevice Implements IVibrationDevice
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows Mobile Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Phone.PhoneContract (introduced v1)


You vibrate the phone by calling the Vibrate method of the VibrationDevice class.

  1. Import the Windows.Phone.Devices.Notification namespace.

using Windows.Phone.Devices.Notification;

  1. Get a reference to the vibration controller by calling the static GetDefault method of the VibrationDevice class.

VibrationDevice testVibrationDevice = VibrationDevice.GetDefault();

  1. Start the vibration by calling the Vibrate method of the VibrationDevice class. Specify the duration as a TimeSpan value.


  1. If necessary, stop the vibration by calling the Cancel method of the VibrationDevice class.



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

Use the vibration feature in moderation. Do not rely on the vibration feature for critical notifications, because the user can disable vibration.

To test an app that uses the vibration controller effectively, you have to test it on a physical device. The emulator cannot simulate vibration and does not provide any audible or visual feedback that vibration is occurring.

An app that is running in the background cannot 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.


Cancel() Cancel() Cancel() Cancel() Cancel()

Stops the vibration of the phone.

public : void Cancel()
void Cancel() const;
public void Cancel()
Public Function Cancel() As void

GetDefault() GetDefault() GetDefault() GetDefault() GetDefault()

Gets an instance of the VibrationDevice class.

public : static VibrationDevice GetDefault()
VibrationDevice GetDefault() const;
public static VibrationDevice GetDefault()
Public Static Function GetDefault() As VibrationDevice
var vibrationDevice = Windows.Phone.Devices.Notification.VibrationDevice.getDefault();

Vibrate(TimeSpan) Vibrate(TimeSpan) Vibrate(TimeSpan) Vibrate(TimeSpan) Vibrate(TimeSpan)

Vibrates the phone for the specified duration (from 0 to 5 seconds).

public : void Vibrate(TimeSpan duration)
void Vibrate(TimeSpan duration) const;
public void Vibrate(TimeSpan duration)
Public Function Vibrate(duration As TimeSpan) As void
TimeSpan TimeSpan TimeSpan

The duration (from 0 to 5 seconds) for which the phone vibrates. A value that is less than 0 or greater than 5 raises an exception.