Mike Eason
Mike Eason

Reputation: 9713

Vibrate Phone in UWP

I'm trying to use the vibration on the device (Windows Phone), however I can't seem to find the appropriate API to achieve this for Windows 10. In Windows 8.x, I can use this, however this is no longer available in Universal Windows Platform.

Can anyone point me in the right direction?

Upvotes: 5

Views: 2023

Answers (3)

andymule
andymule

Reputation: 382

As of Jan 2016, you:

Right-click References in your Solution, Add Reference->Extensions->Windows Mobile Extensions for the UWP

Then you can

using Windows.Phone.Devices.Notification;

and actually use it by:

Windows.Phone.Devices.Notification.VibrationDevice v = VibrationDevice.GetDefault(); v.Vibrate(TimeSpan.FromMilliseconds(500));

Upvotes: 11

bkribbs
bkribbs

Reputation: 734

Posted as a comment several minutes ago and now I'm confident this is what you need:

Use the Windows.Phone.Devices.Notification.VibrationDevice class and the Vibrate method it contains.

https://msdn.microsoft.com/en-us/library/windows/apps/windows.phone.devices.notification.vibrationdevice.vibrate

Upvotes: 2

virgula24
virgula24

Reputation: 533

check this, might help you. and the link you are using may be using a different api. anotehr thing I found on Microsoft documentation is that you cannot trust it, keep that in mind https://msdn.microsoft.com/en-us/windows.phone.devices.notification.vibrationdevice.vibrate

Upvotes: 0

Related Questions